Right before I was about to post a question on why this script wasn't working, I changed an addition to subtraction and viola!
Anyways as the question name suggests, how or what do I have to put into this code to make the character move along with the block.
Does it involve CFraming the player along with their position?
local Part = script.Parent -- this is the Part we will move
local start = script.Parent.Start.Value
local finish = script.Parent.Finish.Value
local Time = 5 -- the time that the script will take to move the part
local Increment = 0.1 -- the Part will move 0.1 studs each time it moves
local Debounce = false
local Diff = finish - Part.Position -- the difference between the two positions
local Mag = Diff.magnitude -- the distance between the two parts
local Direction = CFrame.new(Part.Position, finish).lookVector
--local Diff2 = start - Part.Position --All of this became useless once I fixed my code
--local Mag2 = Diff2.magnitude --I'll keep it for reference
--local Dir2 = CFrame.new(Part.Position, start).lookVector -- and to shame myself eternally
function MovePart() -- function to move the Part
if Debounce then return end -- end the function if debounce is true
Debounce = true -- make Debounce true so the function can't run
for n = 0, Mag, Increment do
Part.CFrame = Part.CFrame + (Direction * Increment)
wait( (Time/Mag) * Increment )
end
wait(3)
for n = 0, Mag, Increment do
Part.CFrame = Part.CFrame - (Direction * Increment) --Used to be a plus *Derp*
wait( (Time/Mag) * Increment )
end
Debounce = false
end
workspace.Button.ClickDetector.MouseClick:connect(MovePart)
The ClickDetector is there for debugging and the likes, which will be replaced with a loop.
https://gyazo.com/89243d997d2c5d0a97ecf9c8aba3b9d7 (Gif showing heiarchy and the previously broken segment Ignore disappearing issue)
Thank you for any help!
~MBacon15

4 comments
Any idea on where to start with that? If I remember correctly, anchored blocks and bodymovers aren't exactly the best of friends. I wouldn't want the platform drooping under the weight of the player
Just Increase the BodyPosition's MaxForce. This is what handles the weight of anything if the MaxForce is high enough.
Also, I forgot to mention to add in BodyGyro. BodyGyro keeps the part from rotating since it's floating. I would Increase the MaxTorque on this one too.
Thanks! Sorry it took so long to accept, I was in Studio discovering. The tip about the MaxForce helped a ton.