Creator tag value not being the player

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

Try doing

Creator_Tag.Value = player.Name

instead of

Creator_Tag.Value = player

Screenshot 2025-07-30 193227

convert the ObjectValue to a StringValue, whenever you use the value just find the player instead of using it directly

Its an objectvalue, you need to change it to a string value

guys i figured it out i just had to put the player in equip so it detect who is holding the tool

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.