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

Why Won't this Work??

Asked by 10 years ago

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

Log in to vote
1
Answered by 10 years ago

Where is the LocalScript exactly? Workspace?

0
StarterPack fahmisack123 385 — 10y
0
Hmm, then I don't know. I just know that LocalScripts should be in Backpack, PlayerGui Grenaderade 525 — 10y
Ad
Log in to vote
0
Answered by
wazap 100
10 years ago
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

0
It won't work in LocalScripts. Can you help me convert this into a normal script, since LocalPlayer will not work in LocalScripts? fahmisack123 385 — 10y
0
What do you mean it wont work in localscripts. wazap 100 — 10y
0
00:42:59.708 - Game passes can only be queried by a Script running on a ROBLOX game server fahmisack123 385 — 10y

Answer this question