I have a part that has CanCollide == false
and Anchored == true
. I want it so that when a player is inside the part(in the area of effect), they will take damage every 1 second or so. I've tried multiple ways of going about this but they seem to never work. Is there a special way of doing this, can anyone help me out? Also, this has to do damage to multiple players over time not just one.
If you already have a working script, you're going to want to create layers so that when the player moves through it they take damage, or a loop that damages any players within it for a certain amount of time. the loop, based on your question, should be wait(1)
.
I made a script to put in the part, it has issues with it and doesn't work much but here it is.
01 | local Settings = { |
02 | [ 'TimeWait' ] = . 2 , -- How long per run |
03 | [ 'Damage' ] = 5 , -- Damage per Run |
04 | } |
05 |
06 |
07 | local using = false |
08 |
09 | script.Parent.Touched:Connect( function (part) -- Part Touched |
10 | if game:GetService( "Players" ):GetPlayerFromCharacter(part.Parent) then -- Checks if the part is a player |
11 | if not using then |
12 | if part.Name = = "Left Leg" or part.Name = = "LeftFoot" or part.Name = = "HumanoidRootPart" then |
13 | using = true |
14 | print ( "Using" ) |
15 | local humanoid = part.Parent:WaitForChild( "Humanoid" ) |