How to deal more damage to the player with values

im making this move where the player gets “a boost in power” and deals more damage than usual for a few seconds. the move is a melee move and does alot more damage than the usual click combat does.

I tried applying boolvalues to the player that was hit with this attack, and going into the click combat script and detecting the value and dealing more damage, but it doesnt work. Im not sure why even after looking on devforum

Heres the code

Code
	hitbox.Touched:Connect(function(per)
					if db == false then
						db = true
						hum:TakeDamage(3)
						if hum.Health <= hum.MaxHealth and not hit.Parent:WaitForChild("More Damage") then
							db = true
							print("gah!")
							hum.WalkSpeed = 0
							hum.JumpHeight = 0
							track:Play()
							tween:Play()
							--------------
							--------------
							tween.Completed:Wait()
							hum.WalkSpeed = 16
							hum.JumpHeight = 7.2
							wait(6)
							db = false
						end
						if hit.Parent:WaitForChild("More Damage") then
							if debounce == false then
								debounce = true
								print("More Damage")
								hum:TakeDamage(30)
								wait(5)
								debounce = false
							end
					end
						hitbox:Destroy()
						task.wait(1.5)
						db = false
					end
				end)

Help and feedback are appreciated, thank you for your time :grinning:

1 Like

Try this:

hitbox.Touched:Connect(function(per)
	if db == false then
		db = true
		
		hum:TakeDamage(3)
		
		if hum.Health <= hum.MaxHealth and hit.Parent:WaitForChild("More Damage").Value == false then
			db = true
			print("gah!")
			
			hum.WalkSpeed = 0
			hum.JumpHeight = 0
			
			track:Play()
			tween:Play()
			tween.Completed:Wait()
			
			hum.WalkSpeed = 16
			hum.JumpHeight = 7.2
			
			task.wait(6)
			db = false
		end
		
		if hit.Parent:WaitForChild("More Damage").Value == true then
			if debounce == false then
				debounce = true
				print("More Damage")
				
				hum:TakeDamage(30)
				
				task.wait(5)
				debounce = false
			end
		end
		
		hitbox:Destroy()
		
		task.wait(1.5)
		db = false
	end
end)

Also, just my opinion but you should use the full names instead of shortened names like humanoid instead of hum so it’s easier for people to read the code.

2 Likes

Would i set the value to true somewhere?

1 Like

like, if the player presses a certain key the value inside them is set to true, then set back to false after a bit? (this is only for example)

1 Like

Yes.

30letters