function onTouched()
if game.Workspace.BaseShot
end
script.Parent.Touched:connect(onTouched)
How can I make this is that if someone gets hit by BaseShot they get killed?
function onTouched()
if game.Workspace.BaseShot
end
script.Parent.Touched:connect(onTouched)
How can I make this is that if someone gets hit by BaseShot they get killed?
You should have the script inside every bullet, or else when multiple bullets spawn, it will be messier to deal with all of them and the code would more more difficult. Anyway, put this inside a bullet:
function touch(part)
if part then
local human = part.Parent:FindFirstChild("Humanoid") or script.Parent.Parent:FindFirstChild("Humanoid") -- This looks bit strange, so you could shoot hats too
if human then
human.Health = 0
end
script.Parent:Destroy()
end
end
script.Parent.Touched:connect(touch)
This discussion is preserved as it was. New answers, comments, and votes are closed.