My gun is working but on online, gun isnt working help me
ball = script.Parent
damage = math.random(12,18)
function onTouched(hit)
local humanoid = hit.Parent:findFirstChild("Enemy")
if hit.Parent.className == "Hat" or hit.Parent.className == "Tool" or hit.CanCollide == false then return end
if hit.Name == "Bullet" then return end
if humanoid ~= nil then
tagHumanoid(humanoid)
if hit.Name == "Head" then
humanoid:TakeDamage(damage * 3)
elseif hit.Name == "Torso" then
humanoid:TakeDamage(damage * 1)
end
wait(2)
untagHumanoid(humanoid)
end
connection:disconnect()
ball.Parent = nil
end
function tagHumanoid(humanoid)
-- todo: make tag expire
local tag = ball:findFirstChild("creator")
if tag ~= nil then
local new_tag = tag:clone()
new_tag.Parent = humanoid
end
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
connection = ball.Touched:connect(onTouched)
wait(4)
ball.Parent = nil
