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

How would you take damage when standing in a specific area for too long?

Hey! I was wondering if there was some sort of script I could use so I can take damage when standing in a specific area for an amount of time? So basically picture this, you enter a house and this eerie music starts playing. When you listen to the audio for too long, you die. That's what I'm trying to accomplish ^^

1 comment

0

Not a request site.

1 answer

✓ Accepted answer

Okay, so I will give you the death script here:

I'd recommend adding a block inside, with cancollide turned off, and transparency set to 0. Place a script inside with this:

script.Parent.Touched:Conenct(function(hit)
	while true do
		wait (60) -- Place time here
		local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
		Player.Character.Humanoid.Health = 0
	end
end)
		

Hope this helps!

2 comments

0

Thank you! This really worked :D

0

Tbh I wouldn't recommend this as it requires that the player is constantly moving and also the problem that sometimes .Touched events dont work

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