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

How can I make this script compatible with Berezaa's Tycoon Kit?

Asked by 9 years ago

Well I am using this Gamepass script to add Cash to a persons amount of cash if they have that Gamepass:

gps = game:GetService("GamePassService");
id = script:WaitForChild("GamePassID");


game.Players.PlayerAdded:connect(function(Player)
Player:WaitForDataReady()
if gps:PlayerHasPass(Player , id.Value) then
stats=Player:WaitForChild("leaderstats")
if stats~=nil then
currency = stats:WaitForChild(script:WaitForChild("Currency").Value)
if currency~=nil then
bonus=script:WaitForChild("AdminCash")
currency.Value = currency.Value+bonus.Value
end
end
end
end)

Inside that script is the GamepassID where I put the ID, the amount of cash, and the currency. It works fine but since I am using Berezaa's tycoon kit it only shows the amount it has but it isnt actually there. The script works fine but Berezaa's tycoon kit uses a Money Storage inside Server Storage as a Smoke. This means he doesnt use leaderstats and that is what this script is going towards, please help modify this script if you can! THANKS!

1 answer

Log in to vote
1
Answered by
Tkdriverx 514 Moderation Voter
9 years ago

When the player enters, make it wait for the value inside MoneyStorage.

gps = game:GetService("GamePassService");
id = script:WaitForChild("GamePassID");


game.Players.PlayerAdded:connect(function(Player)
    Player:WaitForDataReady()
    if gps:PlayerHasPass(Player , id.Value) then
        stats=game.ServerStorage:WaitForChild("MoneyStorage")
        if stats~=nil then
            currency = stats:WaitForChild(Player.Name)
            if currency~=nil then
                bonus=script:WaitForChild("AdminCash")
                currency.Value = currency.Value+bonus.Value
            end
        end
    end
end)
Ad

Answer this question