To get all the players you can use :GetChildren() and pairs to get all the children. This is an example of GetChildren.
local workspacechildren = workspace:GetChildren()
print(#workspacechildren)
This is pairs:
for _,v in pairs(workspace:GetChildren()) do
print(v.Name)
end
Now we get all the players:
for _,v in pairs(workspace:GetChildren()) do
if v.ClassName == "Player" then
print(v.Name)
v.Character.Torso.CFrame = CFrame.new(0,0,0)
Instance.new("ForceField", v.Character)
end
end
Just edit the above script.
I hope this helps!
EDIT
Perci1 Found an error. I meant to say game.Players:GetChildren().
for _,v in pairs(game.Players:GetChildren()) do
if v.ClassName == "Player" then
print(v.Name)
v.Character.Torso.CFrame = CFrame.new(0,0,0)
Instance.new("ForceField", v.Character)
end
end
2 comments
There aren't Players in workspace -- only character models. These have the classname of "Model", since they're models. Just loop through Players directly.
Additionally, you should use the 'IsA' method when checking what type an Object is, never the ClassName itself.