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

Help? My gamepass script isnt working and im trying to get it to give cash ingame.

Asked by 7 years ago

I'm a beginner scripter, i'm using Zeds tycoon kit because I don't know how to make my own yet, this script is mine though as are many in my game, small simple ones as yet again I'm a beginner so help would be greatly appreciated. As stated above i'm using Zed's Tycoon kit and i'm trying to make a script to give people 10,000 cash when they join, i've been studying wiki.roblox but I just can't seem to make it work. Help would be greatly appreciated.

Script

id = 540679791
for i,v in pairs (game.Players:GetPlayers()) do
    if v then
        if game:GetService("MarketplaceService"):PlayerOwnsAsset(v,id) then
            local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(v.Name)
            if cashmoney then
                cashmoney.Value = cashmoney.Value + 10000
            end
        end
    end
end

Thanks for your time

--Species

0
I recommend you trying to script or get some friends before making a game. hiimgoodpack 2009 — 7y

1 answer

Log in to vote
0
Answered by
az_iee 19
7 years ago

Hello! So here's a solution to your problem:

You should use the game pass service instead of marketplace service, also you need to use :PlayerHasPass()

Here's an example, also your script fixed:

id = 540679791
for i,v in pairs (game.Players:GetPlayers()) do
    if v then
        if game:GetService("GamePassService"):PlayerHasPass(v,id) then
            local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(v.Name)
            if cashmoney then
                cashmoney.Value = cashmoney.Value + 10000
            end
        end
    end
end

The variables as you can see for :PlayerHasPass is (PLAYER,GAMEPASSID) Hope this worked!

0
Have you seen his question? That's not what he is asking. hiimgoodpack 2009 — 7y
0
Thanks I just had to edit a few things like onPlayerEntered and such, I forgot about that. anyways, couldn't have done it without you! Unkn0wn_Species 20 — 7y
0
No problem! az_iee 19 — 7y
Ad

Answer this question