#Help with intvalues for creating leaderstats

1 messages · Page 1 of 1 (latest)

marble jasper
#

local population = Instance.new("IntValue")
population.Value = "0/"..settings.EconomySettings.Base.MaxPopulation
population.Name = "👤"
population.Parent = leaderstats

i know why it doesnt work, but is it even possible to make it so the value displays something like 0/X instead of just 0 WHILE keeping it an intvalue so i can update it later. If i make it a string value i wont be able to update it later so is there any solution for this.

fair widget
#

?

#

@marble jasper

#

what do you mwan

#

mean

#

just make it string or smtg?

#

you can have alot of way to do it

#

first

#

use string value

marble jasper
#

i think i figured it out

#

lemme

#

tell u what i did

#

so

fair widget
#

oh

#

bruh

#

ok

marble jasper
#

i made

#

an int value for my population

#

and then

#

parented it to the player instead of the leaderstats folder so it wouldnt show

#

and then i made a stringvalue that displayed the 0/whatever

fair widget
#

what

#

isnt it supposed to show

marble jasper
#

and then a function to update the string value whenever the intvalue changed

#

if i made the int value show

marble jasper
#

it would just show "0"

fair widget
#

oh what

marble jasper
#

so i had to make a stringvalue

fair widget
#

try

marble jasper
#

in order to make it say

fair widget
#

try

marble jasper
#

0/whatever

#

?

fair widget
#

tostring(int.Value)

marble jasper
#

oh wait

#

you might be cooking

#

but will i be able to edit it later based on an int value so that it stays consistant

fair widget
#

edit what

marble jasper
#

the actual number

fair widget
#

you mean change the value in the intvalue?

#

yea

marble jasper
#

not just the string

fair widget
#

it basically just change the value from a number to a string

marble jasper
#

yeah but

fair widget
#

use IntVal.Changed

marble jasper
#

how do i detect if that number in the string is greater than something

#

for a shop or smh

fair widget
#

it'll fire everytime its value change

marble jasper
#

cuz i cant do >=

#

for a string

fair widget
#

then

#

you use

#

tonumber(string)

#

💀

marble jasper
#

ok im like

#

losing my mind

fair widget
#

becareful tho it might return nil so you'll have to do if type(tonumber(string)) ~= "number" then return end

#

let me sum it up

#

its just

#

tonumber

#

tostring

#

and .Changed:Connect(function())

marble jasper
#

ok im gonna

elfin gladeBOT
#

studio** You are now Level 2! **studio

marble jasper
#

try and figure out what this means

#

give me like 12 hours

#

i love coding 😄

fair widget
#

12 hours 💀

#

it literally

#

just mean

#

what the name says

#

but yea

indigo otter
#

just use a string value

#

and have a separate intvalue for the actual value and connect to value changed

gusty compass
#

you can do it with collection service, add a tag

rose maple