Trampoline-Like Part

I’m creating a obby where there are certain parts that bounce you backwards when you run into them. I attempted to use velocities, but I can’t figure out how to make you go a direction relative to where you touched the part.

Edit: I just realised I put this in Code Review instead of Scripting Support. Why do I always do this to myself

This can be done by changing the Velocity property of a part.

Example:

By changing the Y-axis of Velocity, this will create an effect of bouncing your player up in the air.

image

Yes, but where I’m stuck is making the player go the opposite direction from where the part was touched instead of a consistent direction.

I’m not sure if this is exactly what you’re looking for but try it out,
Basically just gets the direction the player is facing and sets the velocity to the opposite direction.

script.Parent.Touched:Connect(function(Hit)
	if Hit.Parent:FindFirstChild("Humanoid") then
		local RootPart = Hit.Parent:WaitForChild("HumanoidRootPart")
		script.Parent.Velocity = RootPart.CFrame.LookVector * -50
	end
end)
3 Likes

That’s exactly what I wanted. Thank you for contributing.

1 Like