Part pushes me off

So I have a moving part that moves in a certain direction when I join the game. Although whenever I jump on the moving part it I don’t move with the part. I was wondering how I can fix this.

I have a model in workspace and inside that model is a script:

for i = 0,1, .001 do
	script.Parent.Parent:SetPrimaryPartCFrame(script.Parent.Parent:GetPrimaryPartCFrame() * CFrame.new(0,0,-1))
	wait()
end

The script works fine but I want it where when you jump on the moving part, you move with it as well. Thanks.

1 Like

Could you show a video of the behavior?

1 Like

have you scripted it to be able to stand on it?

1 Like

No, the script that I provided is the only script connected to the part.

Sorry for bad quality.

That’s expected behavior, remember that you’re only setting the CFrame of the part, and sadly the player just slides off of it.

A way to “fix” this is by setting the player’s CFrame equivalent to the part’s CFrame every time the player is touching it.

This video should help.

2 Likes

I agree with @Downrest . Another option is maybe use the new cframe’s position and orientation and set the part’s .Position and .Orientation. This will give you the behavior you’re looking for.

local newCf = CFrame.new() -- the new cframe
part.Position = newCf.Position
part.Orientation = Vector3.new(newCf:ToOrientation())*180/math.pi
2 Likes