So I have a moving platform, or better said, a moving model. I get the BodyPhysics objects with the Body Velocity and such, but these (From what I've observed) are to move parts alone. However, I am trying to move a model that moves the players standing on top. I was reading this DevForum on how to do this and it was telling how Jailbreak got it's players to stay on the train while it was moving. Here it is:
https://devforum.roblox.com/t/jailbreak-train-platform-system/236339/10
I tried to reinterpret that, but I don't think I am doing it correctly. From what I got from it, was you multiplied the inverse of the average of the CFrames inside the model, then multiplied it by the player's HumanoidRootPart CFrame. That is what I did. I have no errors, but it isn't keeping the player on the platform as it moves up.
I have one script that moves the platform, and one that changes the player's RootPart CFrame. Here are both of them:
Moving The Platform:
local Platform = script.Parent
Platform.PrimaryPart = Platform.Center
while true do
for i = 1,1 do
wait()
Platform:SetPrimaryPartCFrame(CFrame.new(Platform.PrimaryPart.Position + Vector3.new(0,3,0)))
end
script.Parent.MovingParts.FirePart.Fire.Heat = 25
script.Parent.MovingParts.FirePart.Fire.Size = 10
for i = 1,12 do
wait()
Platform:SetPrimaryPartCFrame(CFrame.new(Platform.PrimaryPart.Position + Vector3.new(0,3,0)))
end
wait(2.5)
script.Parent.MovingParts.FirePart.Fire.Size = 2
script.Parent.MovingParts.FirePart.Fire.Heat = 1
wait(.5)
for i = 1,13 do
wait()
Platform:SetPrimaryPartCFrame(CFrame.new(Platform.PrimaryPart.Position + Vector3.new(0,-3,0)))
end
wait(3)
end
Changing the RootPart CFrame:
local MoveFolder = script.Parent.Parent.MovingParts
local startCF = script.Parent.Parent.Center.CFrame
local CFramingParts = MoveFolder:GetChildren()
for i, v in pairs(CFramingParts) do
startCF = startCF * v.CFrame
wait()
return startCF
end
local RelE = startCF / 29
local Rel = RelE * script.Parent.CFrame:Inverse()
local controller = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:WaitForChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.Character.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame * Rel
end
script.Parent.TouchEnded:Connect(function(hit)
if hit.Parent:WaitForChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.Character.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame / Rel
end
end)
end)
Please help me understand what I can do in this situation.
