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

Can someone help?? My Gamepass/Badge cash giving keeps breaking.

I've put it into the script where the cash is created too like someone suggested a while back, but it keeps working and not working (mostly not working) and i'm confused on why this is.

Can someone help?

I have multiple badges/gamepasses that I need this for and I also don't know how to put it all in one single function could someone help out with that too?

Gamepass/Badge script

game.Players.PlayerAdded:connect(function(plr)
    local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(plr.Name)
    if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,540679791) then
        print(plr.Name .. " owns the VIP")
        if cashmoney then
	wait(1)
            cashmoney.Value = cashmoney.Value + 10000
        end
    else
        print(plr.Name .. " doesn't own VIP")
    end
end)

Thanks for your time

-Species

1 comment

0

Is this in a local script, or a server script, if so what service does it reside in?

1 answer

Hello,

I made an assumption that the player owns the gamepass. Image of game explorer : Game Explorer I also assumed that "PlayerMoney" is a folder, in which resides a NumberValue which name is = plr.Name.

game.Players.PlayerAdded:connect(function(plr)
    local Asset = game:GetService("MarketplaceService"):GetProductInfo('ID_HERE') --Put ID
	local cashmoney = game.ServerStorage.PlayerMoney:findFirstChild(plr.Name)

    print(Asset.Name .. " has been sold : " .. Asset.Sales.." times.")
    if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,'ID_HERE') then
        print(plr.Name .. " owns the VIP")
		if cashmoney ~= nil then 
			wait(1)	
			print(cashmoney.Name,cashmoney.Parent,plr.Name,cashmoney.Value)
			cashmoney.Value = cashmoney.Value + 10000
		end
		
    else
        print(plr.Name .. " doesn't own VIP")
    end
end)


I am still learning RbxLua.

Thank you for reading.

2 comments

0

Does this have anything to do with cash giving for the gamepass/badge?

0

Oh okay let me edit it.

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