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

How can I make the player's hip height increase to a specific amount when it is near a part?

So my plan is to make a script that if you're near the red part your hip height is increased to a specific value, but if it is not it stays the same.

Diagram

1 comment

0

have you even started to try

1 answer

To do this you want to use Magnitude to get the distance between the player and the part. Check out the Developer wiki on it here but i attempted this and i got a good result.

local Part = game.Workspace:WaitForChild("HipHeightPart")

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		
		while wait() do
			local Magnitude = (char.Torso.Position - Part.Position).Magnitude
			if Magnitude <= 10 then
				char.Humanoid.HipHeight = 5
			else
				char.Humanoid.HipHeight = 0	
			end
		end
	end)
end)

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