Hey, so I've been trying to teleport everyone in the server to a specific block, however, I keep getting the error of: "Attempt to Index local 'player' (A nil value.) Any help?
function startGame()
local AvaliableMaps = MapsFolder:GetChildren()
local SelectedMap = AvaliableMaps[math.random(1, #AvaliableMaps)]
SelectedMap:Clone()
SelectedMap.Parent = workspace
ForText.Value = "Test"
local RealEditingMap = SelectedMap
print(RealEditingMap)
local EveryoneElseBlock = RealEditingMap.Jail.EveryoneElse
for _, Player in next, game:GetService("Players"):GetChildren() do
local Torso = Player.Character:FindFirstChild("Torso")
if Torso then
Torso.CFrame = CFrame.new(EveryoneElseBlock.Position)
end
end
end
Then Comes up with this error: Link

6 comments
is this a regular script in the server or a local script on the client?
This is a regular script
so it's in the server?
you can't get 'LocalPlayer' from the server. That can only be accessed from the client in a localscript
However, is in a bindable function which is all sorted, as message with a print (print("hello world")). I only added the part where it comes up with the message.
Oh, then what should I do?