local ScreenGUI = script.Parent.Parent
local RightArrow = ScreenGUI.Right.Positive
local LeftArrow = ScreenGUI.Left.Negative
local PlayerUI = ScreenGUI.Main.PlayerName
local Players = game:GetService(“Players”)
local CurrentPlayer = 1
RightArrow.MouseButton1Click:Connect(function()
if CurrentPlayer < #Players:GetPlayers() then
CurrentPlayer += 1
else
CurrentPlayer = 1
end
local Player = Players:GetPlayers()[CurrentPlayer]
local PlayerChar = game.Workspace:FindFirstChild(Player.Name)
if PlayerChar then
local Hum = PlayerChar:FindFirstChildOfClass("Humanoid")
if Hum then
PlayerUI.Text = Player.Name
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = Hum
end
end
end)
LeftArrow.MouseButton1Click:Connect(function()
if CurrentPlayer > 1 then
CurrentPlayer -= 1
else
CurrentPlayer = #Players:GetPlayers()
end
local Player = Players:GetPlayers()[CurrentPlayer]
local PlayerChar = game.Workspace:FindFirstChild(Player.Name)
if PlayerChar then
local Hum = PlayerChar:FindFirstChildOfClass("Humanoid")
if Hum then
PlayerUI.Text = Player.Name
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = Hum
end
end
end)
if #Players:GetPlayers() > 0 then
local Player = Players:GetPlayers()[CurrentPlayer]
local PlayerChar = game.Workspace:FindFirstChild(Player.Name)
if PlayerChar then
local Hum = PlayerChar:FindFirstChildOfClass("Humanoid")
if Hum then
if Player.Name ~= game.Players.LocalPlayer.Name then
PlayerUI.Text = Player.Name
local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = Hum
end
end
end
end
this is my script and all it does is it doesnt go to the humanoid or humanoidrootpart or any part of the body but it previews the name on the textlabel