It's NOT a localscript the error code: attempt to index nil with 'PlayerGui'
The script
function onClicked() local c = game.Players:GetChildren() for i = 1, #c do c[i].Character.UpperTorso.CFrame = CFrame.new(script.Parent.Parent.Teleport.Position) end player.PlayerGui.Tasksbar.t1.Visible = true -- the gui player.PlayerGui.Tasksbar.t2.Visible = true -- gui player.PlayerGui.Tasksbar.t3.Visible = true -- gui end script.Parent.ClickDetector.MouseClick:connect(onClicked)
The problem is that the variable "player" isn't defined. There are several ways to get the player, there is 1 main one for the server and another one for the client, to access the player on the server you can add a players.PlayerAdded event to your code, or if the code is on the client use game.Players.LocalPlayer. Also I recommend not using :connect since it's deprecated use :Connect instead.
You don't have player properly defined, fix:
function onClicked() local c = game.Players:GetChildren() for i = 1, #c do c[i].Character.UpperTorso.CFrame = CFrame.new(script.Parent.Parent.Teleport.Position) c[i].PlayerGui.Tasksbar.t1.Visible = true -- the gui c[i].PlayerGui.Tasksbar.t2.Visible = true -- gui c[i].PlayerGui.Tasksbar.t3.Visible = true -- gui end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Because you're getting a table of players and referencing an index for each player, therefore c[i] represents the current player, so you can adjust each gui like that.