Part giving infinite JumPower

Hello! So i have a problem with a part let me explain what im trying to achive

What am I trying to achieve?

So what I am trying to achive is a part that gives me +30 JumpPower and not a specific value like for example 100.

What is the problem?
When I touch the part, it gives the JumpPower a specific value and I don’t want that to happen since I have tools that give +30 of JumpPower

What solutions have I tried?
The first solution I have tried is adding +30 to the JumpPower and not a specific value but every time I touch the part it gives me +30 +30 +30 etc

I tried to add Debounce and I put that if I got to Stage 41 Debounce = false but it is not the best solution and sometimes it doesn’t work so I don’t know what to do.

I need help :confused: :frowning:

1 Like

I’ve had an issue similar to this. Basically I have an obby game, and when you finish the mini-lobby you step in a green pad to get points. For a while the amounts were skyrocketing instead of giving the necessary amount. I used someone’s tutorial a while ago (I forgot who) but basically you create a blacklist for the player. I’m not good with adjusting features of a player’s Humanoid (in this case, JumpPower) so I’m not going to include that part. I edited the tutorial from the player because the tutorial maker’s goal was to make it so that the player could only touch it once per server. Here I made it so you can add a cool down. However, if you only want the player to touch it once per server, you can just delete the table.remove section. Enough talk, here’s the code!

local blacklist = {}
local players = game:GetService("Players")

local function isInBlackList(Player)
	for _, value in ipairs(blacklist) do
		if value == Player then
			return true
		else
			return false
		end
	end
end

local function isInTable(tableValue, numToFind)
	local found = false
	local index = nil
	for i, v in pairs(tableValue) do
		if v == numToFind then
			found = true
			index = i
            break
		end
	end
	return found, index
end

script.Parent.Touched:connect(function(hit)
	local player = players:GetPlayerFromCharacter(hit.Parent)
	if player then
		
		--check for the player in the list
		if isInBlackList(player) == false then
			-- If the player was not in the blacklist already, add them into it
			table.insert(blacklist, player.UserId)
			-- Do stuff here. You can add a wait() statement here as it will act as a cooldown in between touches.
			
		end
		local playerIsInBlacklist, index = isInTable(blacklist, player.UserId)
		if playerIsInBlacklist then
			table.remove(blacklist, index)
		end
	end
end)
2 Likes