Any Ideas how to tell the game to find all players with the Players service and then moving their CFrame? Kinda new to using the Players service.
Hello I understand you must be a novice scripter. I'm here to help.
-- So first you must gather the things you want or get the children of the parent(the instance) -- Instance(in this case is game.Players) -- In order to keep track of the children we have to name them as a variable like this local Children= game.Players:GetChildren() -- Get children is a method to obtain every object that is inside a said instance such as Players --Now we have to look though each child. We do that with index,last Child in pairs (Object) do -- Like this for i,v in pairs (Children) do -- so I is the index meaning all of the Children and v is the child that the script is currently on. -- so v replaces Children v.Character:MoveTo(Vector3.new(1,1,1)) end -- So v is the current child the script is on. Character is the character of the player -- and to position Models you have to use the method :MoveTo(Vector3.new(x,y,z)) --
This script cycles through all players and moves their torso to a certain position
for _, player in pairs(game.Players:GetPlayers())do --cycles through every "player" in Players if player then local character = player:FindFirstChild("Character") if character then character.Torso.CFrame = CFrame.new() end end end
Closed as Not Constructive by Perci1 and M39a9am3R
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?