I have tried many different ways but nothing works correctly.
I want to be able to push a particular object away from the player when it is clicked, just give it a little nudge so that it will slide away in the direction the player is facing.
I have tried many different ways but nothing works correctly.
I want to be able to push a particular object away from the player when it is clicked, just give it a little nudge so that it will slide away in the direction the player is facing.
If you plan to do this using Velocities, I would recommend using a bodyvelocity and taking the lookVector of the character’s HumanoidRootPart’s CFrame.
Depends on your implementation.
Does the object use physics? Set the part’s network owner to the client and then set the part’s velocity to (Part.Position - PlayerCharacter.HumanoidRootPart.Position).Unit * Speed
on the clientside (this ensures quick response time for the player that interacted with it. You can clear the network owner once it’s done moving, see https://developer.roblox.com/en-us/articles/Network-Ownership for more information). If you do it this way I recommend setting the part’s physical properties so that it slides nicely.
Is the part anchored? You’ll need to manually interpolate a CFrame in that same direction. The math you decide to use to perform this task this is ultimately up to you, but if needed, I can give some pointers.
It might be appropriate to add that to the existing velocity to make it feel more “physical”, like the player is “punching” the part with a specific impulse. If OP likes that, also consider dividing the change in velocity by the mass of the part (and any connected parts), so that heavier objects are harder to “punch”.
It is only one object, a raft, I need the player to be able to push the raft in case the player just so happens to run the raft ashore. the raft isn’t anchored.