#im making a button simulator and im trying to figure out this rebirth part

1 messages · Page 1 of 1 (latest)

candid lintel
#

if you know any button simulators (like BS:ED) i need help on how to make rebirths work

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

    local c = Instance.new("NumberValue", ls)
    c.Name = "Cash"
    c.Value = 0.00
    
    local mult = Instance.new("NumberValue", ls)
    mult.Name = "Multiplier"
    mult.Value = 0.00
    
    local re = Instance.new("NumberValue", ls)
    re.Name = "Rebirths"
    re.Value = 0.00
    
    while task.wait(1) do
        sfxearn:Play()
    
        local baseCash = 1

        local totalCash = baseCash

        if mult.Value > 0 and re.Value > 0 then
            totalCash = baseCash * mult.Value * re.Value
        end

        c.Value += totalCash
    end
    
    ls.Parent = plr
end)
narrow slate
#

ok

#

uh

#

for global stats

#

its better to use a modulescript instead of NumberValues

#

then for a rebirth simply increae rebirth amount and set everything else's value to 0

candid lintel
#

and wdym to use a module script

narrow slate
#

use a module script as a global table

#

use that table to handle valyes

#

it makes it easier to save AND takes less time to add more values

candid lintel
narrow slate
bold parrotBOT
#

studio** You are now Level 16! **studio

narrow slate
#

then, get that module in a different script to use it

#

currencies = require(game.ModuleScript) —NOT like this, do it like wherever you put the model

#

THEN in every script you required it, you can do
currencies.currency1 += 10

#

and that should increase that value across all scripts (assuming its being run on the server)

#

you can also use it like
workspace.Part.SurfaceGui.TextLabel.Text = “Cash: “..currencies.currency1

#

this will be annoying to switch to but 100% a good idea if this game gets published

candid lintel
#

ahh

candid lintel
#

i have these

narrow slate
#

yea def use the module instead

candid lintel
narrow slate
candid lintel
narrow slate
candid lintel
candid lintel
#

hmm

candid lintel
#

i have this function toh

#

tho

narrow slate
#

except add a comma after every variable

candid lintel
#

one final question to end this 5 day thread 😭

#

how do i connect them together and where

narrow slate
#

but then you can type module.currencyname = whatevervalueuwant

candid lintel
narrow slate
#

except the module

candid lintel
#

oh...

#

what do i replace

candid lintel
#

ok last question fr lmao

narrow slate
#

think of the module as just

#

a table

#

with thise values in there

#

but its across all scripts

candid lintel
#

i just put them directly to the leaderstats

#

is that a bad thing

narrow slate
candid lintel
bold parrotBOT
#

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

narrow slate
#

all u need is the module

candid lintel
#

wait what

narrow slate
#

and whenever u gotta make a new currency just add it to the module

candid lintel
narrow slate
candid lintel
narrow slate
#

well

#

now u can make the rest of the game

#

but all the values should be easier to reference and make more of

candid lintel
#

every second lets say

narrow slate
candid lintel
#

OHHHHHHHH

#

omg

#

i get it

narrow slate
#

and for your original question

#

just add rebirths by money but divided by like five or something

#

then set money to zero

candid lintel
#

why divide

narrow slate
#

and reset multi aswell

#

well u want to get less rebirths then you have cash

#

oh wait

#

i forgot button simulators are different

candid lintel
#

yeah

narrow slate
#

nvm just all u need to know is
increase rebirths by amount if they have enough cash
set cash and multi to zero after

candid lintel
#

so like how to multiply the multiplier

#

nvm

candid lintel
#

ok tysm

#

ill be bumping this thread until i get it eventually

narrow slate
#

should be pretty similar to values in usage

candid lintel
#

bump

candid lintel
#

omg this is going too logn

candid lintel
candid lintel
narrow slate
#

looks good

#

but wdym leaderstats

candid lintel
narrow slate
candid lintel
narrow slate
#

oh

#

its a folder

candid lintel
#

yes

narrow slate
#

are you expecting more than 1 player in a server?

candid lintel
#

yes

candid lintel
narrow slate
#

yes

#

okay

#

uhhh

#

yea i gotta be honest man i dont know what to do if theres more than 1 player

#

oh

#

i got an idea

#

instead of having a folder to keep stats

#

make the module like this:

#

{"player1name" = {"cash" = 10, "multi" = 1}, "player2name" = {"cash" = 500, "multi" = 3}, "player3name" = {"cash" = 10000, "multi" = 200} }

#

where you make a table in the module under the name of the player

candid lintel
#

i think that would take too long

narrow slate
#

when a player joins add their name as a table

narrow slate
#

other than what you had before

#

which probably isnt the greatest idea

#

pretty sure it would make datasaving near impossible

candid lintel
#

ahhhhhh i forgot about data saving

#

i think ill restart

#

ill just keep the guis and other stuff

#

and redo every script

narrow slate
#

its not a bad idea to restart

#

ive restarted a game twice before i got to release a third one and that ones really faulty anyway

narrow slate