I am trying to find a way to make this van move down the road then when it goes through the black part regen at the other side here’s a pic of the script I got right now
local B = script.Parent.BLACK
Number 2, you are doing “script.Parent” for everything, but only thing that is referring to is “BLACK”, try moving the script into the model instead of “BLACK”
local B = script.Parent.BLACK
local G = script.Parent.GREY
local R = script.Parent.RED
local W = script.Parent.WHITE
local L1 = script.Parent.LIGHT1
local L2 = script.Parent.LIGHT2
wait(2)
function move (x, y, z)
for i=1,1 do
script.B.G.R.W.L1.L2.Position = script.Parent.Position + Vector3.new(x,y,z)
wait(0.1)
end
end
while true do
move(0,0,0)
move(-1,0,0)
end
local B = script.Parent.BLACK
local G = script.Parent.GREY
local R = script.Parent.RED
local W = script.Parent.WHITE
local L1 = script.Parent.LIGHT1
local L2 = script.Parent.LIGHT2
local RVelements = {B, G, R, W, L1, L2}
function move (x, y, z)
for _, v in pairs(RVelements) do
v.Position = script.Parent.Position + Vector3.new(x,y,z)
wait(1)
end
end
while wait() do
move(0,0,0)
move(-1,0,0)
end
script.B.G.R.W.L1.L2.Position
This bit of code in your original snippet here was the issue. When expanded it would read like this:
Given that you are just moving the bus (no physics attached), I’d recommend welding together your bus, then use a Tween to move the the whole model from one part of the map to another. You also won’t have to rely on any pesky while wait() do loops if you use a Tween and instead can rely on the more reliable .Completed event for managing the bus object itself.
only thing is the obby I need it for will be randomly generated so it will not all ways be in the same position but the welding and tween is a good idea
No problem, if it worked feel free to mark the post as the solution. Also you can increase/decrease the number in “wait(1)” to increase/decrease the movement speed of the “REDVAN”.
local B = script.Parent:WaitForChild("BLACK")
local G = script.Parent:WaitForChild("GREY")
local R = script.Parent:WaitForChild("RED")
local W = script.Parent:WaitForChild("WHITE")
local L1 = script.Parent:WaitForChild("LIGHT1")
local L2 = script.Parent:WaitForChild("LIGHT2")
local RVelements = {B, G, R, W, L1, L2}
function move (x, y, z)
wait(0.1)
for _, v in pairs(RVelements) do
print(v)
v.Position += Vector3.new(x,y,z)
end
end
while wait() do
move(0,0,0)
move(-1,0,0)
end