The touched event is great when it comes to a player touching a brick, but what about being able to award points whenever the player is on the same spot or brick for a couple seconds, then the touched event wouldn't really work.
how exactly would I make this, like make a player lose 1 hp every second its on the base part and if its not, the player wouldn't lose damage?
script.Parent.Touched:connect(function(hit) human = hit.Parent.Humanoid human.Health = human.Health - 1 wait(1) -- it doesnt make sense, help? end)
active=false script.Parent.Touched:connect(function(hit) human = hit.Parent:FindFirstChild("Humanoid") if human then active=true while active==true do human:TakeDamage(1) wait() end end end) script.Parent.StoppedTouching:connect(function(hit) active=false --This right here basically makes the while loop at the top stop, --because if you notice it basically says "while active is true do this.." end)
Please note that I haven't tested this, but it should work.
script.Parent.Touched:connect(function(hit) human = hit.Parent.Humanoid human.Health = human.Health - 1 wait(1) end
If you want, just create a loop for when the human is still in contact, also the wait(1) is how long until the scirpt ends, try this maybe.
script.Parent.Touched:connect(function(hit) human = hit.Parent.Humanoid human.Health = human.Health - 1 wait(1) human = hit.Parent.Humanoid human.Health = human.Health - 1 wait(1) human = hit.Parent.Humanoid human.Health = human.Health - 1 wait(1) end
Now i can't promise it working but there's a possibility.