✓ Accepted answer
Consider using TweenService.
Although it'd be smoother on the client end, I'd imagine this water/lava is supposed to kill players or something along the lines of that. You could use a RemoteEvent and already have instructions on the client as to how to move the part, but that may be a little risky, considering you'd be assuming the client is not deleting the part or whatever, and it would be a lot more work.
Regardless, I'm going to give you a server-end solution:
local part = game.Workspace.Part
local ts = game:GetService("TweenService")
local duration = 10
local style = Enum.EasingStyle.Linear
local direction = Enum.EasingDirection.InOut
local info = TweenInfo.new(duration, style, direction, 0, false, 0)
local startPosition = Vector3.new(0, 0, 0)
local endPosition = Vector3.new(0, 10, 0)
while true do
wait(3)
if part.Position == startPosition then
local tween = ts:Create(part, info, {Position = endPosition})
tween:Play()
tween.Completed:Wait()
else
local tween = ts:Create(part, info, {Position = startPosition})
tween:Play()
tween.Completed:Wait()
end
end
Now, this is just an example of what you can do.
Take what you will from it. If you need an explanation for something, shoot me a comment.
2 comments
Works really good, thank you for the help
No problem :)