Please properly format code you're including when opening a question. You can see how to do that here.
Your code:
function tp()
local players = game.players:GetPlayers()
local parts = game.Workspace.Parts:GetChildren
for i = 1,#players do
players(1).Character.HumanoidRootPart.CFrame = game.Workspace.Part.CFrame + Vector3.new(0,3,0)
end
end
while wait(3) do
tp()
end
The issue is the following error from output:
function arguments expected near 'for'
The issue is that on line 3, you didn't provide parenthesis to the :GetChildren() function. When using a function, like GetChildren(), you need to provide the parenthesis.
local parts = workspace.Parts:GetChildren()
In your for loop, you call your variable '1'? It would make sense to use something like i to define a variable.
You also are trying to index a player using parenthesis. To index something from a table you use brackets -> [key]
players[i].Character.HumanoidRootPart.CFrame = workspace.Part.CFrame + Vector3.new(0,3,0)
Your finished code should be something like:
function tp()
local players = game.Players:GetPlayers()
local parts = workspace.Parts:GetChildren()
for i = 1,#players do
players[i].Character.HumanoidRootPart.CFrame = workspace.Part.CFrame + Vector3.new(0,3,0)
end
end
while true do
tp()
wait(3)
end
Edit:
Overlooked spelling mistakes in your code and is now fixed in final. You also use game.Workspace.Model when you could just use workspace.Model.
2 comments
Please put it in a code block.
You asked a question yesterday and I linked a page.