Hi there! I made a Teleport GUI. And everything I made was perfect but ever since I put the ScreenGui to ReplicatedStorage because I only want it to myself. Anyway I'm having trouble in Line 6 of this Script:
spawn = game.Workspace.HouseArea player = script.Parent.Parent.Parent.Parent local funtcion onClicked() local spawnArea = game.Workspace.HouseArea; local playerList = game.Players:GetChildren; --It keeps saying function arguments expected near ":" local playerToTeleport = nil; for key, value in pairs(playerList) do playerToTeleport = game.Workspace:FindFirstChild(value.Name); if playerToTeleport ~= nill then player.Torso.CFrame = CFrame.new(spawnArea.Position); end end end script.Parent.MouseButton1Down:connect(onClicked)
Please Help
GetChildren
is a method, meaning you have to call it -- it will have parenthesis immediately after it.
local playerList = game.Players:GetChildren()
Parenthesis enclose the function's arguments which is what that error was requesting you provide.
You are recommended to use :GetPlayers()
instead of :GetChildren()
since it is more semantically meaningful.