Answered by
5 years ago Edited 5 years ago
in-game leaderstats:
first you need to insert a numbervalue in the button, after get the player from the character. then check in the leaderstats if the player have equals or greater then the cost. to find that out, you will need to compare the costs. so,
1 | script.Parent.Touched:Connect( function (h) |
2 | local plr = game:GetService( "Players" ):GetPlayerFromCharacter(h.Parent) |
3 | local currency = plr.leaderstats.PUTCURRENCYNAMEHERE |
4 | local cost = script.Parent.Cost |
6 | if currency.Value > = cost.Value then |
but, we didn't remove the cash. so that means they can get as many morphs they want so our final product will be:
01 | script.Parent.Touched:Connect( function (h) |
02 | local plr = game:GetService( "Players" ):GetPlayerFromCharacter(h.Parent) |
03 | local currency = plr.leaderstats.PUTCURRENCYNAMEHERE |
04 | local cost = script.Parent.Cost |
06 | if currency.Value > = cost.Value then |
07 | currency.Value = currency.Value-cost.Value |
actual robux:
first you need a touched event, a gamepass, and to get the player from the character. then after that, you need a purchase prompt for the gamepass and to get the marketplaceservice. so what would you do is
1 | script.Parent.Touched:Connect( function (h) |
2 | local plr = game:GetService( "Players" ):GetPlayerFromCharacter(h.Parent) |
3 | marketservice = game:GetService( "MarketplaceService" ) |
5 | if marketservice:UserOwnsGamePassAsync(plr.UserId, gamepassidhere) then |
8 | marketservice:PromptGamePassPurchase(plr.UserId,gamepassid) |