I made weapon with a "blade" and a script that adds a "creator" ObjectValue to whatever Humanoid the blade hits, the only problem is, it won't add anything to the Humanoid (Player or NPC I've tried both) and when I try to detect the Humanoid, it works.
script.Parent.Blade.Touched:Connect(function(hit)
game.Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(char)
local thing = Instance.new("ObjectValue",hit.Parent.Humanoid)
thing.Name = "creator"
thing.Value = char.Name
print(thing.Value and "test")
end)
end)
end)
It won't print anything I've also done this script:
script.Parent.Blade.Touched:Connect(function(hit)
game.Players.PlayerAdded:Connect(function(p)
local thing = Instance.new("ObjectValue",hit.Parent.Humanoid)
thing.Name = "creator"
thing.Value =p.Name
print(thing.Value and "test")
end)
end)
Both scripts don't work

2 comments
do not forget to accept ifmy answer helps
Your problem is PlayerAdded as this function is called when a player joins the server and can not be called by a script only received