Alright. So I wanna add a creator tag into my gun so I can track kills. I tried to make one but IT doesn't seem to work. Here is the script (btw this is NOT the WHOLE script of the gun, just the part where the creator tag gets mentioned)
function OnRayHit(cast, raycastResult, segmentVelocity, cosmeticBulletObject) local hitPart = raycastResult.Instance local hitPoint = raycastResult.Position local normal = raycastResult.Normal if hitPart ~= nil and hitPart.Parent ~= nil then local humanoid = hitPart.Parent:FindFirstChildOfClass("Humanoid") if humanoid then UntagHumanoid(humanoid) humanoid:TakeDamage(8) TagHumanoid(humanoid, Player) end MakeParticleFX(hitPoint, normal) end end function TagHumanoid(humanoid, player) local Creator_Tag = Instance.new("ObjectValue") Creator_Tag.Name = "creator" Creator_Tag.Value = player Debris:AddItem(Creator_Tag, 2) Creator_Tag.Parent = humanoid end function UntagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") if tag ~= nil then tag.Parent = nil end end end