local CoolDown = false
local tool = script.Parent.Parent
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
game:GetService("Debris"):AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
script.Parent.Touched:Connect(function(hit)
local character = tool.Parent
local humanoid = hit.Parent:WaitForChild("Humanoid")
local player = game:GetService("Players"):GetPlayerFromCharacter(character)
if humanoid then
local ran = math.random(1,2)
local model = hit.Parent
if script.Parent.Parent.damage.Value == true then
if CoolDown == false then
CoolDown = true
script.Parent.ParticleEmitter.Enabled = true
task.wait(0.5)
script.Parent.ParticleEmitter.Enabled = false
CoolDown = false
UntagHumanoid(humanoid)
TagHumanoid(humanoid, player)
hit.Parent.Humanoid.Health -= 6
if ran == 1 then
script.Parent.Parent.Handle.hit:Play()
elseif ran == 2 then
print("k")
script.Parent.Parent.Handle.hit2:Play()
end
task.wait(1)
CoolDown = false
end
end
end
end)
so im trying to make the creator value be the player that damage the model, when i hit the humanoid i check the value and it doesn’t have my player name for some reason
