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

Why Won't this Work??

I've tried this code before, not sure if it gave an output error, because when I played solo, the output gave tons of things not related to this script AND, it's not working giving the 10K Cash:

This is in a LocalScript in StarterPack

id = 103728213
access = {"name1","name2"}
game.Players.PlayerAdded:connect(function(player)
    if Game:GetService("GamePassService"):PlayerHasPass(player, id) or game.Players.LocalPlayer.Name == #access then -- Did I use the # correctly? Or should I use something else?
		while true do
        game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + 10000 --Did I find the leaderstats correctly?
		wait(1)
		end        
    end
end)

What I want it to do is that if a player has a specific Game Pass, or their name is in the access table, they will be entitled with 10KCash per second

2 answers

Where is the LocalScript exactly? Workspace?

2 comments

0

StarterPack

0

Hmm, then I don't know. I just know that LocalScripts should be in Backpack, PlayerGui

id = 103728213
access = {name1=true,name2=true}
local player = script.Parent
repeat player = player.Parent until player:IsA"Player"
    if Game:GetService("GamePassService"):PlayerHasPass(player, id) or access[player.Name] then 
        while true do
	        player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 10000 --Did I find the leaderstats correctly?
        wait(1)
        end        
    end

Edited

3 comments

0

It won't work in LocalScripts. Can you help me convert this into a normal script, since LocalPlayer will not work in LocalScripts?

0

What do you mean it wont work in localscripts.

0

00:42:59.708 - Game passes can only be queried by a Script running on a ROBLOX game server

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