Hi I'm trying to make a grenade tool and I'm working on the damage this is what I got
hitplayers = {}
script.Parent.Touched:Connect(function(hit)
local obj = hit.Parent
local hum = hit.Parent:FindFirstChild("Humanoid")
if hit.Parent.Name == "Outrider" and hit.Parent ~= script.Wielder.Value and hit.Parent ~= hitplayers then
table.insert(hitplayers,hit.Parent)
hum:TakeDamage(50)
end
end)
I'm trying to make it so it wont hit the same player twice how do I fix this?

10 comments
now it does not do damage at all
oh you forgot to connect the function maybe
it kills him all the way its suppose to take half health but thanks
OH YEAH I FORGOT TO CONNECT THE FUNCTION MY BAD
wait i connected the touch function what about the other one?
its not supposed to be connected
ok it still does not work
You're inserting the character instance into the array, and checking their name.. :P
You're inserting the character instance into the array, yet checking the name in the function.. :P
yeah I made that mistake a lot yesterday