Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local runser= game:GetService("RunService")
- if runser:IsClient() then
- local function MakeSpectatorGui(player)
- local SG = Instance.new("ScreenGui",player.PlayerGui)
- SG.Name = 'ViewerGui'
- local frame = Instance.new("Frame",SG)
- frame.BackgroundColor3 = Color3.new(0,0,0)
- frame.AnchorPoint = Vector2.new(.5,.5)
- frame.BackgroundTransparency = .5
- frame.Position = UDim2.new(.5,0,.75,0)
- frame.Size = UDim2.new(.5,0,.125,0)
- frame.Selectable = true
- frame.Active = true
- frame.Draggable = true
- local left = Instance.new("TextButton",frame)
- left.Name = 'Left'
- left.Size = UDim2.new(0.25, 0,1, 0)
- left.Text = '<-'
- local right = Instance.new("TextButton",frame)
- right.Size = left.Size
- right.Name = 'Right'
- right.Parent = frame
- right.AnchorPoint = Vector2.new(1, 1)
- right.Position = UDim2.new(1, 0,1, 0)
- right.Text = '->'
- local center = Instance.new("TextButton",frame)
- center.AnchorPoint = Vector2.new(1, 1)
- center.Position = UDim2.new(0.5, 0,1, 0)
- center.Size = UDim2.new(.25, 0,.5, 0)
- center.Name = 'Center'
- center.Text = 'Center'
- local TL = Instance.new("TextLabel",frame)
- TL.AnchorPoint = Vector2.new(0.5, 0)
- TL.Position = UDim2.new(0.5, 0,0, 0)
- TL.Size = UDim2.new(.5, 0,.5, 0)
- TL.Text = 'nil'
- for _,v in pairs(frame:GetChildren())do
- v.BackgroundColor3 = Color3.new(0,0,0)
- v.Font = Enum.Font.SciFi
- v.TextColor = BrickColor.new("Institutional white")
- v.TextScaled = true
- end
- local cam = workspace.CurrentCamera
- local num = 1
- left.MouseButton1Click:Connect(function()
- local players = game:GetService("Players"):GetChildren()
- num = num - 1
- if num>=0 then
- num = #players
- end
- while true do
- local players = game:GetService("Players"):GetChildren()
- if num==0 then
- num = #players
- end
- local cpl = players[num]
- local cpc = cpl.Character
- if cpc~=nil then
- if cpc:FindFirstChild('Head',true) then
- -- cam.CFrame = cpc:FindFirstChild('Head',true).CFrame
- cam.Focus = cpc:FindFirstChild('Head',true).CFrame
- cam.CameraSubject = cpc:FindFirstChild('Head',true)
- TL.Text = cpl.Name
- break
- else
- num = num - 1
- end
- else
- num = num - 1
- end
- wait()
- end
- end)
- right.MouseButton1Click:Connect(function()
- local players = game:GetService("Players"):GetChildren()
- num = num + 1
- if num>#players then
- num = 1
- end
- while true do
- local players = game:GetService("Players"):GetChildren()
- if num>#players then
- num = 1
- end
- local cpl = players[num]
- local cpc = cpl.Character
- if cpc~=nil then
- if cpc:FindFirstChild('Head',true) then
- -- cam.CFrame = cpc:FindFirstChild('Head',true).CFrame
- cam.Focus = cpc:FindFirstChild('Head',true).CFrame
- cam.CameraSubject = cpc:FindFirstChild('Head',true)
- TL.Text = cpl.Name
- break
- else
- num = num - 1
- end
- else
- num = num - 1
- end
- wait()
- end
- end)
- center.MouseButton1Click:Connect(function()
- while true do
- if player.Character~=nil then
- if player.Character:FindFirstChild('Head',true)
- then
- cam.Focus = player.Character:FindFirstChild('Head',true).CFrame
- cam.CameraSubject = player.Character:FindFirstChild('Head',true)
- TL.Text = player.Name
- num = 1
- break
- end
- end
- wait()
- end
- end)
- owner.Chatted:Connect(function(msg)
- if string.find(msg:lower(),'g/nog') then
- if owner:FindFirstChild('ViewerGui',true) then
- owner:FindFirstChild('ViewerGui',true):Destroy()
- end
- end
- end)
- print'Say "g/nog" to destroy gui.'
- end
- MakeSpectatorGui(owner)
- else
- error'Script must be local.'
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement