Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Game pass script dealing with a cash leaderboard isn't working, why not?

local passId =  392347461 -- Change this to your game pass' ID
local GPS = game:GetService("GamePassService")

if GPS:PlayerHasPass(player, passId)  then
function onPlayerEntered(newPlayer)
local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Value = 50,000
end

If I'm correct i don't think i have the check for pass line, and i don't know how to do that. Can anyone help? And this is in ServerScriptService by the way.

2 answers

✓ Accepted answer

To me, your code is very off. You should study this, fixed, version of your code.

local passId = 392347461

game.Players.PlayerAdded:connect(function(plr)
	if game:GetService("GamePassService"):PlayerHasPass(plr, passId) then
		local stats = Instance.new("Folder", plr)
		stats.Name = "leaderstats"
		local cash = Instance.new("IntValue", stats)
		cash.Name = "Cash"
		cash.Value = 50000
	end
end)

1 comment

0

Thank you

Understand it

I know, this doesn't solve your question and you're going to curl up and cry because the world is nasty to you, but your script shows an obvious lack of understanding for what goes on in the script and why, and therefore part of the reason you're confused for why it's not working.

I'd suggest going back and taking a look at how functions and events work before trying this, because you might just understand where you went wrong.

2 comments

0

As correct as this is, stick to more neutral-perspective answers please.

0

My neutral-perspective answer is that if the person is skiddying a script without showing any understanding of it, my job isn't fixing it for them.

This discussion is preserved as it was. New answers, comments, and votes are closed.