Why is my jumpboost script not working?

Hello Developers. I was coding a jumpboost script and it is failing. Any ideas why?

local players = game:GetService("Players")
local player = players.LocalPlayer
local part = script.Parent
local currentj = player.Humanoid.JumpPower
local current = #currentj
local yes = nil


part.Touched:Connect(function(player)
	yes = true
end)

part.TouchEnded:Connect(function(player)
	yes = false
end)

while true do
	if yes == true then
		currentj = 20
	else
		currentj = current
	end
end

Thanks

Local scripts won’t run inside of parts, try to put it in StarterPlayerScripts.

Also, you can’t get the length of a value local current = #currentj, remove the #.

1 Like

Like @24Nick_42 said local scripts will not run inside parts but also something else is that you are trying to get the Humanoid of a player. You need to get the character from the player and then get the humanoid cuz the player itself does not have a humanoid only the character of the player

From the documentation about Player.Character on how to get the character from the player (ignore the stuff u don’t need):

Player.Character (roblox.com)

The issue is you’re using a localscript inside of a part.

You should either:

Put the localscript in the StarterPlayerScripts and change the part variable to something like
workspace.Part

Or:

Make the script a server script and use the hit parameter to get the player.