Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Moving platform without making it fall?

How am I able to use BodyPosition so I can make a platform (brick) move back and forth without making it fall down? I tried but it fell down instead of making it stay floated in the air. Here's the code I inserted:

local s = game.Workspace.S
local f = game.Workspace.F
local p = game.Workspace.Platform
local bp = p.BodyPosition

while true do
	bp.Position = s.Position
	wait(3)
	bp.Position = f.Position
	wait(3)
end

2 answers

I'd say you should try setting the BodyPosition maxForce to something or rather if I were you I wouldn't even use BodyPosition you can just use the :lerp() method of the part which can be found here:

http://wiki.roblox.com/index.php?title=Lerp

Also if you need further help on as to how you could use the :lerp() method here I asked a question about it before and got a great answer! Here is the link:

https://scriptinghelpers.org/questions/26684/help-with-lerp-please

I hope I helped in some way or another and thank you for asking such a great question and reading my answer.

~~ KingLoneCat

My new script with :lerp() was working, but the character did not follow the brick's position... What should I do to make the character stay on the platform when it moves instead of treating it like losing a platform and fall?

Here is the NEW script:

local s = script.Parent.Parent:WaitForChild('Start')
local f = script.Parent.Parent:WaitForChild('Finish')
local p = script.Parent.Parent:WaitForChild('Platform')

while true do
	for n = 0.00, 1.00, wait() do
		p.CFrame = script.Parent.CFrame:lerp(s.CFrame, n) -- set the parts CFrame to what you got from :Lerp()
		wait(0.1)
	end
	wait(5)
	for n = 0.00, 1.00, wait() do
		p.CFrame = script.Parent.CFrame:lerp(f.CFrame, n) 
		wait(0.1)
	end
	wait(5)
end

1 comment

0

You could weld a seat to the platform that you are lerping and make the character teleport to it so he sits down.... That would work. Or you could weld the character's legs down to the platform. That would work as well....

This discussion is preserved as it was. New answers, comments, and votes are closed.