you can try to use Roblox’s default ClassicSword, it have a creatortag data store for simplier working and you can just working out by making only a creatortag detection only!
Nice to you sticking around to help and remaining patient.
I used the ClassicSword, it still doesn’t give me any cells.
Is there a way to give cells on kill without using the creator tag?
Oh, I see the issue now.
it has an error saying that there is no player
The character is the actual players model not the player itself. But it is hard to get this without a remote event. You should use a remote event which passes on the players data.
try using the classic sword then do a script in the NPC!
script.Parent.Humanoid.Died:Connect(function() --humanoid died function
local creatortag = script.Parent.Humanoid:FindFirstChild("creator")
if creatortag then --if npc didnt die by accident
local killer = creatortag.Value --this defined as a killer! now we want to give player a score
kill.leaderstats.Cells.Value = 10 --give player a cells value to 10 (set to 10 not add by)
end
end)
@B4Mp4 please try it first!, sorry i just woke up!
i sure it doesnt have! because damaging a humanoid just taking it only a damage, just a damage without storing a killer data
I’ve found an issue with the ClassicSword’s Script.
which causes:
that means that you did right
just change the .leaderstats to :WaitForChild(“leaderstats”)
Ok, so it still didnt work, maybe I need to totally remake the sword and the Npc.
robloxapp-20210709-2150127.wmv (1.7 MB)
ima do it for you! please wait!!
this is the function that every roblox weapon have:
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
this were used to put a creator tag!
ok so i fixed it, this is what it should work!
as you can see in the output! it have a killer name appeared!
i already have a place file if you need it.
@B4Mp4
Ok, I’m gonna need to see where to put the piece of script…
no, i got a problem already! i think it because on the creator tag on the classicsword.
change the line
Creator_Tag.Parent = humanoid
above
Debris:AddItem(Creator_Tag, 2)
so it will place in a humanoid after it get deleted!
the death detector (put a script inside a dummy) and type:
script.Parent.Humanoid.Died:Connect(function() print("Ded") local tag = script.Parent.Humanoid:FindFirstChildOfClass("ObjectValue") if tag then local killer = tag.Value print("Player"..killer.Name.." killed me!!") end end)
if you still got a problem, i’ll just send you a rbxl file
Could you send me the rbxl file? I think I need to analyze it to see what I’m doing wrong.