I making a script where a model moves in one direction. There are no errors in the output, but it just prints the line in blue and the script fails to work. Here is the code around that line.
local p = game.Workspace.Stardrive:GetChildren() for i = 1,#p do repeat p.CFrame = p.CFrame + Vector3.new(0,0,10) until game.Workspace.Stardrive.Shape.Positon == Vector3.new(-37.96, 16.255, 868.946) end
Can anybody help to identify the problem?
You're giving as specific position so instead use the greater/less than or equal to sign for the == sign because it's most likely not to be exactly at the position so give a better answer by if it goes over or if it is exact then stop moving it
local stardrive = game.Workspace:WaitForChild("Stardrive") local shape = stardrive:WaitForChild("Shape") local p = stardrive:GetChildren() for i = 1,#p do repeat p.CFrame = p.CFrame + Vector3.new(0,0,10) until shape.Positon.Z <= 868.946 end
So I added :WaitForChild() it's a built-in roblox function that yield until that instance is not nil (until the instance exists )