Someone had made this script for me which if Player1 touch Player2 they take damage over time. So i was wondering if someone can double check it cause i tried to add a key press button like e to activate then i think i screwed it all up. So can someone please double check the script and add a press e to active?
settings = { --This is a table, this table will store all the variables that you can change.
damageTime = 12, -- How many times It will damage the player
inbetweenTime = .7, -- The time you have to wait until It damages again
damage = 10, -- How much damage it will do
debounce = false, -- Not recommended to change this
}
for i,v in pairs(game.Players:GetChildren()) do --[[ Grab all the players in the player service --]]
workspace[v.Name].Touched:Connect(function(hit) --[[ This is a function which will fire when it is touched --]]
if hit.Parent:FindFirstChildOfClass('Humanoid') then --[[ This will check if it hits something w/ a humanoid --]]
if not settings.debounce then -- Checks if debounce is false
settings.debounce = true
for i = 1,settings.damageTime do -- This is a for loop that will loop a certain amount of times
hit.Parent:FindFirstChildOfClass('Humanoid'):TakeDamage(settings.damage) --[[ this will take damage--]]
wait(settings.inbetweenTime) -- this will wait for the time classified in settings.
end
settings.debounce = false
wait(7)
end
end
end)

4 comments
Im going to try it out right now. Mind if i could friend you?
I don't mind
If you want you can friend me on my main https://www.roblox.com/users/74254309/profile
k