Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Part teleports back instnatly after reaching its goal, I want it to move back smoothly halp?

Asked by
Synth_o 136
6 years ago
local Part = workspace.Part
local test = workspace:WaitForChild('test')
while wait(1) do 
for num = 0,1, .01 do
    Part.CFrame = CFrame.new(7.31, 0.5, 33.97):lerp(CFrame.new(57.15, 25.33, 33.97), num) 
    if Part.CFrame == CFrame.new(57.15, 25.33, 33.97) then
        Part.CFrame = CFrame.new(57.15, 25.33, 33.97):lerp(CFrame.new(7.31, 0.5, 33.97, num))
    end
    game:GetService("RunService").RenderStepped:wait()
end
end

That is what i have so far, any advice/halp?

0
put wait()'s in between the functions Nikkulaos 229 — 6y

1 answer

Log in to vote
1
Answered by
Prestory 1395 Moderation Voter
6 years ago

So i want you to create two parts exactly opposite eachother name one pointA name the other pointB and group them then create the part thats going to slide and call it slider then put this script into the slider

local model = script.Parent.Parent
local slider = model.slider
local start = model.pointA
local finish = model.pointB
local bodyPos = slider.BodyPosition
local time = 2 

while true do
    bodyPos.position = start.Position
    wait(time)
    bodyPos.position = finish.Position
    wait(time)
end

Put that script into the slider then insert a BodyGyro and BodyPosition into the part.

Ad

Answer this question