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)

5 comments

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.

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.

0

You are putting the 'elseif' on the wrong location.

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

0

I got it working it is resolved :) I just put something in my Data Script :)