Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Doesnt give the award?

Asked by
22To 70
8 years ago

So it doesnt give no award at all not even the original amound and i dont know why. if those who own teh gamepass kill the npc they get the x2 amount but everyone gets nothing when they kill the npc.

local GamePassService = game:GetService("GamePassService") -- Get the gmaepass service
local passid = 382015968 -- The pass id which is needed for x2 xp

game.Players.PlayerAdded:connect(function(player) -- gets the player when joined
player.CharacterAdded:connect(function(Character) -- fires when character is added
    Character.Humanoid.Died:connect(function() -- connects to humanoid's death
    local tag = Character:FindFirstChild("creator") 
    if tag ~= nil then 
        if tag.Value ~= nil then 
                local Leaderstats = tag.Value:FindFirstChild("leaderstats")  -- Get the leaderstats
                if GamePassService:PlayerHasPass(player, passid) then -- If the player has the pass, we proceed to giving the player x2 gold/xp
                    if script.Parent.SETTINGS:FindFirstChild("XP") ~= nil and script.Parent.SETTINGS:FindFirstChild("Gold") ~= nil then
                        Module.AddStats(Leaderstats, script.Parent.SETTINGS.XP.Value*2, script.Parent.SETTINGS.Gold.Value*2) -- Times the values by two, which is giving them x2 the gold/xp
                    else 
                        print("Can't find XP and Gold!")
                    end
                else -- If they do not have the pass, the function proceeds here
                if script.Parent.SETTINGS:FindFirstChild("XP") ~= nil and script.Parent.SETTINGS:FindFirstChild("Gold") ~= nil then 
                    Module.AddStats(Leaderstats, script.Parent.SETTINGS.XP.Value, script.Parent.SETTINGS.Gold.Value) -- Give them the regular rates
                else 
                    print("Can't find XP and Gold!")
                end
            end
        end
    end
    end)
end)
end)


0
What is "creator"? GoldenPhysics 474 — 8y

Answer this question