Edit: The script below has been fixed, check the comments below
I’m currently having trouble with my script which damages the player and inserts a creator tag to their humanoid. I think the tag is being created, but it can’t identify the user. I don’t see any outputs being created. Please tell me other possible ways to fix this issue, everything else in this script functions.
This is my current script:
script.Parent.Parent.MeleeDamage.OnServerEvent:Connect(function(player, x) local function TargetPlayer(hit) humanoid = hit.Parent:FindFirstChild("Humanoid") local tag = Instance.new("ObjectValue") tag.Value = humanoid.Parent.Name -- This is where I think the trouble is happening, but can't identify possible solutions tag.Name = "creator" tag.Parent = humanoid game:GetService("Debris"):AddItem(tag,5) end if humanoid then humanoid:TakeDamage(35) end script.Parent.Parent.Parent.Hitbox.Touched:Connect(TargetPlayer) humanoid = nil end)
Thanks for your time! Stay safe and well .