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

Player wont stay on moving part using BodyMovers?

Asked by 3 years ago

I made a script that allows a part to move between two parts using BodyPosition. However, when the part moves, the player doesn't move with it, and instead just falls off.

local movePart = script.Parent
local startPart = movePart.Parent.StartPart
local endPart = movePart.Parent.EndPart
local bodyPosition = movePart.BodyPosition

movePart.BodyGyro.CFrame = movePart.CFrame

while true do
    bodyPosition.Position = startPart.Position
    wait(5)
    bodyPosition.Position = endPart.Position
    wait(5)
end

GIF to show what I mean: https://gyazo.com/4b4d7592ffcc81861917d49829e1b3fd

1 answer

Log in to vote
0
Answered by 3 years ago

try changing from this

local movePart = script.Parent
local startPart = movePart.Parent.StartPart
local endPart = movePart.Parent.EndPart
local bodyPosition = movePart.BodyPosition

movePart.BodyGyro.CFrame = movePart.CFrame

while true do
    bodyPosition.Position = startPart.Position
    wait(5)
    bodyPosition.Position = endPart.Position
    wait(5)
end

to this

local movePart = script.Parent
local startPart = movePart.Parent.StartPart
local endPart = movePart.Parent.EndPart
local bodyPosition = movePart.BodyPosition

while true do
    bodyPosition.Position = startPart.Position
    wait(5)
    bodyPosition.Position = endPart.Position
    wait(5)
end
0
Thanks for answering. It turns out I didn't actually need that line of code for the BodyGyro. However, it didn't fix the issue of the player not moving with the moving part. bomblitz06 94 — 3y
Ad

Answer this question