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 this part hit all the players it touches but not loopkill them?

How do i make the blackhole part hit all the players it touches but not loop the damage so it wont instantly kill the player

touch = true
	blackhole.Touched:connect(function(hit)
		local ehum = hit.Parent:findFirstChild("Humanoid")
		if ehum and ehum ~= hum then
			local target = hit.Parent
		if touch == true then --  If i take this off, it would hit all the players
				touch = false -- but also loop the damage and instantly kill them
		ehum:TakeDamage(35)
		ehum.Sit = true
		wait(0.1)
		target.Torso.Anchored = true
        wait(3)
		target.Torso.Anchored = false
		
		end

Please help me if you can

1 comment

0

You're missing an "end", and you never defined "hum".

2 answers

I didn't really check your script, but I'll answer your question. There is a 'trick' that is really useful when you are dealing with this kind of event, that fires multiple times.

It's called Debounce, and it simply uses a variable to create a condition when the event is triggered. When the event fires, that variable will be set to false and it will keep it from firing for a while - usually set by time.

You CAn make a cooldown OF damage using bolean values like:


Bol = true

IF bol = true then Bol = false Print("hay") Wait(3) Bol = true End


Remember that Bol = true needs to be outside of the touched function.

2 comments

0

That didn't help at all.

0

its if bol == true not if bol = true

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