ive modified your script so the player moves alongisde the part,
local brick=script.Parent
while wait(0.5) do
brick.Velocity = Vector3.new(15,0,0)
for I=1,50 do
brick.CFrame=brick.CFrame+Vector3.new(0.5,0,0)
wait()
end
brick.Velocity = Vector3.new(0,0,0)
wait(0.5)
brick.Velocity = Vector3.new(-15,0,0)
for I=1,50 do
brick.CFrame=brick.CFrame+Vector3.new(-0.5,0,0)
wait()
end
brick.Velocity = Vector3.new(0,0,0)
end
however i still strongly suggest you use body movers
this is the code for a 6x1x6 part,
BodyGyro;
maxtorque = 400000, 400000, 400000
p=10000
BodyPosiiton
mastorque = 100000, 100000, 100000
p = 5000
positon = (varies)
script;
local model = script.Parent
local platform = model.Platform
local bodyPos = platform.BodyPosition
local pos1 = platform.Position
local pos2 = (platform.CFrame*CFrame.new(14,0,0)).p
local waitTime = 2
bodyPos.position = pos1
platform.Anchored = false
local currentPos = pos1
while wait(waitTime) do
if currentPos == pos1 then
currentPos = pos2
bodyPos.position = pos2
elseif currentPos == pos2 then
currentPos = pos1
bodyPos.position = pos1
end
end
2 comments
you could use body position and body velocity instead of cframe
The reason I'm using CFrame is because it just glides along at one speed. I don't want it to slow down.