I get no error messages to the output, but when I run the game, the only thing in the BodyPosition position is 0,0,0 and when I try to manually change it, it returns to 0,0,0, and help?
Here is the code:
targets = game.Workspace.Path:GetChildren() Main = script.Parent.Main function run() for i,v in pairs(targets) do if Main.Position ~= v.Position then local position = v.Position Main.BodyPosition.position = Vector3.new(position) end wait() end run() end run()
When you set the variable 'position' it is already a Vector3 value, not just 3 numbers. Line 8 is the same as:
Main.BodyPosition.position = Vector3.new(Vector3.new(0,0,0))
All you need to do is replace the Vector3.new(position) with position so your code will look like this:
targets = game.Workspace.Path:GetChildren() Main = script.Parent.Main function run() for i,v in pairs(targets) do if Main.Position ~= v.Position then local position = v.Position Main.BodyPosition.position = position end wait() end run() end run()
Actually I think the problem is that "position" doesn't exists, because it's with the "P" uppercase, so:
Main.BodyPosition.Position = position