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

[SOLVED] Double XP script not working when I kill NPC?!?! Anyone help?

Asked by 6 years ago
Edited 6 years ago

I've been trying to add a double experience script for hours and i've yet to figure out how it works ...If anyone could help it would be greatly appreciated!

local GamePassService = game:GetService("GamePassService")
local GamePassId = 989673709

local Humanoid = script.Parent.Humanoid
local Player = game.Players.LocalPlayer

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
                Leaderstats.XP.Value = Leaderstats.XP.Value + 25
            elseif GamePassService:PlayerHasPass(Player, GamePassId) then
                if Leaderstats ~= nil then
                    Leaderstats.XP.Value = Leaderstats.XP.Value + 50
                end
                wait(0.1)
                script:Remove()
            end
        end
    end
end

Humanoid.Died:Connect(PwntX_X)
0
Your question isn't clear, when do you need the double XP? Because from what I see, assuming the "25" as the default, and "50" is the double, it only doubles when the player has a certain gamepass. Mineloxer 187 — 6y
0
We don't know if you have the gamepass and if that is causing the error. Also, your "elseif" in line 14 means they wont get double exp unless leaderstats doesnt exist. RockerCaleb1234 282 — 6y
0
You are putting the 'elseif' on the wrong location. Nowaha 459 — 6y
0
I was attempting to make a double xp script. I was trying to make it where you kill the mob and you get double the xp if you have the gamepass TheForgottenTale 23 — 6y
0
I got it working it is resolved :) I just put something in my Data Script :) TheForgottenTale 23 — 6y

Answer this question