The script is supposed to give players double points when they kill a NPC but it isn't working. Can someone help me, please?
Here's the code:
local Humanoid = script.Parent.Humanoid -- NPC Name
function PwntX_X()
local tag = Humanoid:findFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
local Leaderstats = tag.Value:findFirstChild("leaderstats")
if Leaderstats ~= nil then
amount = 50
id = 564358419
for i,v in pairs(game.Players:GetPlayers()) do
if v then
if game:GetService("MarketplaceService"):PlayerOwnsAsset(v,id) then
v.Leaderstats.Cash.Value = v.Leaderstats.Cash.Value + amount * 2
else
v.Leaderstats.Cash.Value = v.Leaderstats.Cash.Value + amount
wait(0.1)
script:remove()
end
end
end
end
Humanoid.Died:connect(PwntX_X)
