#Money

1 messages · Page 1 of 1 (latest)

elder pagoda
#

so i got like money in my game which u get 2 per minute , thats the script of it in serverscript service:

local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"

local cash = Instance.new("NumberValue", leaderstats)
cash.Name = "Cash"
cash.Value = 0
while player do
    wait(60)
    cash.Value += 2
end

end.

**and than the local script in the gui where the money pops up: **

local player = game.Players.LocalPlayer
script.Parent.Text = player.leaderstats.Cash.Value
player.leaderstats.Cash:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.Text = player.leaderstats.Cash.Value
end)

And i want like if they buy 50 that they get 50 how do i make that script etc?

strong gust
#

marketplaceservice

#

you could make an event after succesful purchase

#

you would need the id of the product

#

and the event of being clicked

#

if clicked then check if player proccesed the robux which roblox does after doing smth with the service (marketplaceservice)

torn pier
#

DISCORD 📜
Join my Discord Community if you want scripting help, participate in events/challenges, and make friends!
https://discord.gg/WC6kPu5W5P

MEMBERSHIPS 🎁
Get Access To My Scripts + More Perks By Becoming a Channel Member! 👇
https://www.youtube.com/@BrawlDevRBLX/join

ADVANCED ROBLOX SCRIPTING SERIES 🔴
https://www.youtube.com/p...

▶ Play video
elder pagoda
#

@torn pier @strong gust guys i dont know 1 % of scripting, the video doesnt help me cuz he is doind another thing im doing about money, could someone write me a script or help me do it fast?

marsh gyroBOT
#

studio** You are now Level 6! **studio

torn pier
strong gust
#

if you can't script that i highly suggest for you to search for a scripter

#

and im also not willing to write a script for you

elder pagoda
rapid vault
#

@elder pagodajust dm me

#

I'm bored Ill write it for you for free its just a small module + server script

long star
#

replace with:

task.spawn(function()
    while player do
        wait(60)
        cash.Value += 2
    end
end)
stark stump
#

also replace with task.wait

elder pagoda
#

@stark stump @long star the script with the 2 money per minute works perfect where’s there the problem?

long star
#

when you do wait(60), it COMPLETELY stops your function for 60 seconds

elder pagoda
long star
#

so if someone else joins during those 60 seconds the script wont run for them

elder pagoda
#

Ima test it out with clients

#

Later

long star
chrome perch
#

use developer productd

elder pagoda
#

So:

replace with:

task.wait(function()
    while player do
        wait(60)
        cash.Value += 2
    end
end)
elder pagoda
long star
elder pagoda
#

from where to where should i replace

#

@long star ?

long star
#

replace this

wait(60)
cash.Value += 2

with that code

elder pagoda
#

btw could you help me privat on smth?

long star
long star
elder pagoda
# long star you can ask here bro <:grrrr:1069935512091099187>

so i have this script in replicaced storage as a module script:
return {
Cash50 = 1234567890, -- <-- replace with your dev product id
Cash100 = 1234567891,
Cash200 = 1234567892,
Cash350 = 1234567893,
Cash500 = 1234567894,
Cash750 = 1234567895,
Cash1000 = 1234567896,
Cash2000 = 1234567897,
Cash5000 = 1234567898,
}

and then in side of each buybutton local script, or function

local MarketplaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer

local PRODUCT_ID = 1234567890 ----- whatever the product ID is for the button

script.Parent.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(player, PRODUCT_ID)
end)

but theres one script left which i dont know where to put:
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")

local PRODUCT_TO_CASH = {
[1234567890] = 50,
[1234567891] = 100,
[1234567892] = 200,
[1234567893] = 350,
[1234567894] = 500,
[1234567895] = 750,
[1234567896] = 1000,
[1234567897] = 2000,
[1234567898] = 5000,
}

local function grantCash(player, amount)
local leaderstats = player:FindFirstChild("leaderstats")
if not leaderstats then return false end

local cash = leaderstats:FindFirstChild("Cash")
if not cash then return false end

cash.Value += amount
return true

end

MarketplaceService.ProcessReceipt = function(receiptInfo)
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then

    return Enum.ProductPurchaseDecision.NotProcessedYet
end

local cashAmount = PRODUCT_TO_CASH[receiptInfo.ProductId]
if not cashAmount then

    return Enum.ProductPurchaseDecision.NotProcessedYet
end

local ok = grantCash(player, cashAmount)
if not ok then
    return Enum.ProductPurchaseDecision.NotProcessedYet
end

return Enum.ProductPurchaseDecision.PurchaseGranted

end

#

so its about when you buy ---$ u get them

long star
#

wydm you dont know where to put it

#

it's a server script so just put it in serverscriptservice

elder pagoda
elder pagoda
long star
#

yeah the last one

elder pagoda
elder pagoda
long star
#

exams all week crying

elder pagoda
elder pagoda
long star
#

normal script

elder pagoda
#

🙏 that it works

elder pagoda
#

i dont get money atall

elder pagoda
main pivot
elder pagoda
main pivot
main pivot
#

yeah but it didn't work, get a refund.

elder pagoda
#

he told me that he is bored and he would do it

#

wdym refund

#

it cost nothing

main pivot
#

wdym 'free not good enough'

long star
#

bro

#

WHAT

#

didnt work

elder pagoda
#

NOT U

#

BUT URS DIDNT WORK TOO

long star
elder pagoda
main pivot
long star
#

LMFAO

#
task.wait(function()
    while player do
        task.wait(60) --use task.wait, wait() is deprecated
        cash.Value += 2
    end
end)
#

is sent you this

elder pagoda
long star
#

ik but I put task.wait instead of task.spawn

elder pagoda
#

I WAS TALKING ABT THE OTHER GUY

main pivot
elder pagoda
#

ragebait

long star
#

no hes right

#

i will think about what ive done

#

anyways the correct code segment is

task.spawn(function()
    while player do
        task.wait(60) --use task.wait, wait() is deprecated
        cash.Value += 2
    end
end)
elder pagoda
#

its

#

error i mean

long star
#

NO NO NO

elder pagoda
long star
#

you dont need the task.wait(function() delete that line

#

that was my typo

elder pagoda
long star
#

is that the whole script

elder pagoda
long star
#

if that is the entire script, add another end) to the end

elder pagoda
#

lemme test

elder pagoda
#

now it shows leaderstats

#

i dont want that

main pivot
long star
#

if you dont want it on the leaderboard name it something else

#

I like to use playerstats

elder pagoda
#

local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local playerstats = Instance.new("Folder", player)
playerstats.Name = "playerstats"

local cash = Instance.new("NumberValue", playerstats)
cash.Name = "Cash"
cash.Value = 0
    task.spawn(function()
        while player do
            task.wait(60) --use task.wait, wait() is deprecated
            cash.Value += 2
        end
    end)
end)
marsh gyroBOT
#

studio** You are now Level 7! **studio

elder pagoda
#

like that?

long star
#

yeah that should work

#

if the folder is named leaderstats it'll automatically be on the leaderboard

polar glade
main pivot
polar glade
#

isnt it spawn

#

not wait

long star
#

meant to say task.spawn

polar glade
#

ok

elder pagoda
polar glade
#

wait what was the problem in the first place

long star
polar glade
#

like you click on a button and it gives you a prompt to buy the money or sum

elder pagoda
main pivot
long star
#

then that GUI will be changing its number based on Player.leaderstats.Cash

elder pagoda
#

vro

long star
#

you have to now change it to Player.playerstats.Cash

main pivot
elder pagoda
#

if i have leaderstats in the script i can see the numbers on the GUI buit if theres playerstats it wont show up on the gui @long star

main pivot
#

and i'm not trying to derail but this is just so sad, idk what else to say because anything i offer will be met with either "wdym" or "where do i put that"

polar glade
#

i have no idea how devproducts work too but i will still try to help

elder pagoda
#

i feel like an little kid who doenst know where his class is

long star
#

to be honest bro

#

you might want to watch a tutorial series

elder pagoda
#

JUST TELL HOW I FIX THAT GNG

long star
#

I did

#

go into the script that changes your money ui

#

and make sure its changing playerstats.Cash

main pivot
elder pagoda
# long star and make sure its changing playerstats.Cash

so:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local playerstats = Instance.new("Folder", player)
playerstats.Cash = "playerstats"

local cash = Instance.new("NumberValue", playerstats)
cash.Name = "Cash"
cash.Value = 0
task.spawn(function()
    while player do
        task.wait(60) --use task.wait, wait() is deprecated
        cash.Value += 2
    end
end)

end)

polar glade
#

lowkey bro just watch brawldev dev products 🤷‍♂️

main pivot
# elder pagoda JUST TELL HOW I FIX THAT GNG

and honestly, start with that first part. get your money system under control first and add saving and loading to it. maybe then, after you already got that working, only then worry about devproducts maybe

long star
#

yeah hate to break it to you but your next best move is a modular cash granting system that integrates profileservice

marsh gyroBOT
#

studio** You are now Level 8! **studio

long star
elder pagoda
#

i found it

polar glade
#

is the problem right now "the money isnt showing up on the gui"

long star
elder pagoda
# long star your issue is not coming from this script

so now thats the local script in the gui:
local player = game.Players.LocalPlayer
script.Parent.Text = player.Cash.Cash.Value
player.Cash.Cash:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.Text = player.Cash.Cash.Value
end)

long star
#

player.playerstats.Cash.Value*

#

you said Cash.Cash

#

not a valid member error

elder pagoda
# long star player.playerstats.Cash.Value*

local player = game.Players.LocalPlayer
script.Parent.Text = player.playerstats.Cash.Value
player.playerstats.Cash:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.Text = player.playerstats.Cash.Value
end)

#

fak this system

#

fak this game

#

fak everything

#

script in roblox CEOs ass

long star
#

yo if you ping me with another code snippet

polar glade
main pivot
#

||player:waitforchild("playerstats")||

elder pagoda
#

im doing this since yesterday

#

for a simple faking system

#

it doesnt work

#

fak this game

polar glade
#

its funny because roblox lua is one of the most easiest code languages to learn

elder pagoda
#

fak scripting

#

fak the CEO

main pivot
elder pagoda
polar glade
elder pagoda
#

I DONT THINK TAHT THIS IS HARD FOR A SCRIPTER

#

seriously fak this game

#

fak money

#

fak everything

long star
elder pagoda
#

fak fak fak

long star
#

not a scripter

main pivot
elder pagoda
polar glade
main pivot
#

so the next best thing i can suggest is just learn basic coding

elder pagoda
#

and no skills

polar glade
#

or just make a game that has like 100 experiments

elder pagoda
#

ima faking hire an faking person

polar glade
elder pagoda
#

fak this person

#

fak everyone

main pivot
polar glade
#

anyways

elder pagoda
polar glade
#

do what pyro fire says

elder pagoda
#

fak school

polar glade
#

just learn and read lua

#

in order to understand

#

the things you're doing

#

from ai

main pivot
#

every competent coder has read this page already (or equivalent), along with everything else in the documentation. if that doesn't sound like a good time to you, well maybe coding isn't for you.

long star
#

drop out of school and become the wolf of roblox in 3 days without knowing how to script

elder pagoda
#

THEN MY MOM IS GONNA FAK THE SHI OUT OF ME

main pivot
elder pagoda
#

ONLY BECAUSE IM BAD AT MATH AND FRANCE

elder pagoda
main pivot
#

well if you want MONE, trust me, trying to beg for code to make a roblox game is not going to get you any.

polar glade
elder pagoda
elder pagoda
#

NO PROBLEMS AT ALL

main pivot
#

if you want actual money, like real money, you should stay in school, go to uni, and get a degree

polar glade
#

okay...

#

this happened from making devproducts btw

elder pagoda
long star
main pivot
#

if you want to stay in computing you could go for a computer science degree, but really the main options are doctor or lawyer. if were in your shoes, i'd aim for lawyer personally.

polar glade
elder pagoda
polar glade
#

and unleash your anger

#

on us

#

take a breather and just learn slowly enough 🤗

main pivot
polar glade
#

if you can do it slowly you can do it quickly

main pivot
#

it just may not seem like it right now, but you have so much time ahead of you.

#

all that stealing of brainrots has rotted your attention span bruh

polar glade
#

ill give him his bikenini taconini or something like that

main pivot
#

in the real world there are no quick fixes, shortcuts, or free lunches, you have to work for everything. even if you were some trust fund kid with inherited millions, you still need to work to keep it.

I must just as a proof of that, just look at pretty much any lotto winner, or those experiments where they give a homeless person like a million dollars. what happens? They blow it. All of it. Almost every time.

"In order to stand still, we must be moving very fast"

polar glade
#

848483 billion per second

#

dude im watching dev product brawl dev video and it doesn't even look that hard (something i still probably wouldn't do) 💔

long star
polar glade
#

for real he's giving you senior ranking quality wisdom

main pivot
# polar glade dude im watching dev product brawl dev video and it doesn't even look that hard ...

ehh they make it look easy for beginners, the correct pattern (in the same way that profilestore is to a naive first time datastore example) is really annoying compared to a basic naive marketplaceservice.promptproductpurchasefinished because exploiters can fire that event in particular with the waspurchased=true for free dev products. you must use processreceipt, which can fail even if you return a successful purchase meaning it fires twice so you get 2 devproduct redemptions for the price of 1 due to poor error handling.

#

so... they make it look easy but to do it properly is really annoying

polar glade
#

but that's basically describing every roblox lua coding video

main pivot
polar glade
#

im going to reminisce slightly

main pivot
#

when you get to my level there isn't really any videos or tutorials about it (the high level problems), you have to read the docs and figure this shit out because of how hyper competitive it is. giving help on this level is on some level, 'aiding your competition'

polar glade
#

i used an alvinblox piggy tutorial and i didn't understand more than half of the things he typed

polar glade
#

because he used modulescripts and such

long star
#

it will save you a gazillion headaches

#

and scalability isnt really possible without them past super basic games

polar glade
main pivot
# long star what are you doing bro<:evilcat:1161027214645665842>

like just as an example, did you know if you have a server script that does game.Players.PlayerAdded:Connect(function(plr) local backpack=plr.Backpack task.wait(10) print(backpack.Parent) end) this will print nil - because the first backpack a player receives gets destroyed and a new one is created along with their character. this is a niche roblox behavior that no one really tells you, and i doubt it's properly covered in any of the tutorials

#

there's no tutorial for that

long star
#

good to know

#

actually I've seen what you mean when I was trying to find a hitbox tutorial

#

and all of them just tell you how to make server hitboxes which weren't good for my use case

#

or god forbid .touched

main pivot
polar glade
#

i tried to do like a tycoon game and it was like claim a plot

#

and it was something like .Touched:Connect(function(hit) and that was it

#

well it just only showed parts touching

#

not finding the player or anything

long star
#
  1. add a script
  2. "now go find my model from toolbox called ___"
polar glade
#

its always like a 6 minute video when its like 25 minutes to do it

long star
#

fr you can tell by the length

polar glade
#
  1. open up roblox studio
  2. go to toolbox
  3. search up ""
  4. put the stuff where they're supposed to be
  5. customize it
  6. you're done
    length: 3:31
long star
#

at some point you have to move past tutorials and move to documentation

#

and thats the point where you can look at the tutorials for something and realize you could do it better

elder pagoda
# long star at some point you have to move past tutorials and move to documentation

yo im using this one rn:
ocal Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local playerstats = Instance.new("Folder", player)
playerstats.Name = "playerstats"

local cash = Instance.new("NumberValue", playerstats)
cash.Name = "Cash"
cash.Value = 0
    task.spawn(function()
        while player do
            task.wait(60) --use task.wait, wait() is deprecated
            cash.Value += 2
        end
    end)
end)

but it doesnt save like if i rejoin i have 0 again how can i fixx taht?

#

@long star baby

long star
long star
#

roblox data doesnt save automatically

#

you have to do it yourself with their datastores

elder pagoda
#

thougt just scripts

long star
#

you can find one on yt or use the example on the profilestore wiki

#

super easy wrapper

elder pagoda
polar glade
#

you do realize you have to make things for yourself in order to remember and learn right

strong gust
#

let him ask for everything

#

thats the larp spirit!