So, I have this elevator in my difficulty chart obby, it makes the player go upwards when they jump into it, I used LinearVelocity.
But the problem is, when the player is going upwards, I can’t control the XZ movements of the player.
Can somebody help me?
Here’s the code:
local hrp = script.Parent.HumanoidRootPart
if not hrp:FindFirstChild("LinearVelocity") then
local velocity = Instance.new("LinearVelocity", hrp)
velocity.Attachment0 = hrp.RootAttachment
velocity.VectorVelocity = Vector3.new(0, 5, 0)
if hit.CFrame.UpVector.X ~= 0 then
velocity.VectorVelocity = Vector3.new(hit.CFrame.UpVector.X, velocity.VectorVelocity.Y, velocity.VectorVelocity.Z)
end
if hit.CFrame.UpVector.Z ~= 0 then
velocity.VectorVelocity = Vector3.new(velocity.VectorVelocity.X, velocity.VectorVelocity.Y, hit.CFrame.UpVector.Z)
end
end
It’s inside StarterCharacterScripts to check if the player touched the elevator