As in the stated question i am trying to make my tool constantly damage the user but it only damages them once unless u rejump in the beam but as long as u stay in the beam u only get damaged once. heres the script i dont know whats the problem..
local DAMAGE = false local db = true function onTouched(hit) local human = hit if (human ~= nil) then human:TakeDamage(500) end end script.Parent.Touched:Connect(function(part) DAMAGE = true script.Parent.Value = part.Parent:FindFirstChildWhichIsA("Humanoid") end) script.Parent.TouchEnded:Connect(function(part) DAMAGE = false end) while true do if DAMAGE == true then if db == true then db = false onTouched(script.Parent.Value) wait (0.05) db = true end end end
please help with ur feedback, also this is just the damage script part. my tool is way bigger
Okay i managed to fix it myself, apparently the problem was that the server was not taking the models from my own tool it was taking it from a pre existing serverstorage model so i edited the wrong stuff lol