Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Vault over a short wall or obstacle script?

Okay so this i a lot to ask, but it would help my game out sooo much. basically is there a way i could make a script in a object with this format: a part: 2 invisible parts as hit boxes on either sides of the object.When the player is in the hit boxes the script activates a loop checking if the player presses the space bar, if he does, stop the player movement and jump power, teleport the player to the center of the part facing the actual obstacle, play animation, when animation is finished teleport player to the other side of the obstacle (please not using world location and relative location to the player like cframe + forward). So in all it looks like the player is running towards an obstacle and when they press space it looks as if they vault over it. Thanks!

1 answer

Sounds like it'd be a simple check of velocity and relative movement. Perhaps something like this

vaultpart = --[[part to vault over]]
while true do
	if player.Character and player.Character.PrimaryPart then
		if (vaultpart.Position - player.Character.PrimaryPart.Position).magnitude < 5 and player.Character.PrimaryPart.Velocity > 15 then
			--vault over the part
		end
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.