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

How do I make double jump but only for the player that touches a certain part?

How do I make double jump but only for the player that touches a certain part? this is the script I found for double jumping but it allows all players to double jump.

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

local uis = game:GetService("UserInputService")

local canDoubleJump = false
local hasLanded = true


humanoid.StateChanged:Connect(function(previous, new)

	if new == Enum.HumanoidStateType.Jumping and hasLanded then

		if not canDoubleJump then canDoubleJump = true; hasLanded = false end


	elseif new == Enum.HumanoidStateType.Landed then

		canDoubleJump = false
		hasLanded = true
	end
end)

uis.InputBegan:Connect(function(input, processed)

	if processed then return end

	if input.KeyCode == Enum.KeyCode.Space then

		if canDoubleJump then

			humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
			canDoubleJump = false
		end 
	end
end)

1 answer

im sorry, you cant request someone to write a script for you. Here is the tips

You need to set your jumping script -> script.Disabled = true if your jumping script is inside the character then this script will work

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local character = hit.Parent
		character.Script.Disabled = false --Your jumping script
	end
end)

let me know if it helps

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