· 4 years ago · May 08, 2021, 03:58 PM
1-- alr so first wh you wanna do is connet bignum/etnum to your datastore and the buttons and whatever else you add.
2--- do not rouch behind this point unless setting it up, you can change yoir bignum to wherever your file is!
3local x = require(game.ServerScriptService.idk.idk) -- find etnum and link it
4local Data = game:GetService("DataStoreService"):GetDataStore("LolTesting1") -- your datastore --- this is where you can reset stats
5game.Players.PlayerAdded:Connect(function(plr) -- find plr upon spawn
6 local s = Instance.new("Folder",plr) -- imprtant, stat folder
7 s.Name = "Stats" -- do not touvh
8 local ls = Instance.new("Folder",plr) -- important, les folder.. (for skill)
9 ls.Name = "leaderstats" -- do not touch
10 --------------- stats
11 local money = Instance.new("StringValue",s) -- firtst stat goes here we need to make a instance
12 money.Name = "Money" -- this is the name to use cmds by oh
13 money.Value = 0 -- this is the value of the stats -- i will make make stats so you guys can have a rough idea lol
14 local multi = Instance.new("StringValue",s)
15 multi.Name = "Multi"
16 multi.Value = 1 -- we alwwayds need atleast one multi for the cash to start rollng in
17 local reb = Instance.new("StringValue",s)
18 reb.Name = "Rebirth"
19 reb.Value = 0 --value
20 local skill = Instance.new("StringValue",ls) -- leadersttas, only change the value if you need to give a boost.
21 skill.Name = "Skill"
22 skill.Value = 0 -- just realised i already wrote what i was gonna say llol
23 -- there you have your stats... now you want to get an "ls"... which is basically leaderstats.. we use can use this for skill.
24 -- now you have your ls (not required) ypu can start adding boosts to money etc before making the acc part of the dataload itslef-- im no teacher so im bad at explainning lool
25 local dataload = Data:GetAsync(tostring(plr.UserId)) -- git stat gud
26 if dataload then -- what this does it is finds the local dataload then getrs the players data (in game stats)
27 money.Value = dataload[1] or 1 -- you always need to have a different dataload for all stats!
28 multi.Value = dataload[2] or 1 -- if you haveissues using these dataloads as well you can easily chnage the actual dataloads its self
29 -- changing stats in dataload is the same as ressetting datakey ibut this iss only for minor reset likes upgrades
30 reb.Value = dataload[3] or 0
31 end --- to end that one particular function of getting the ds
32
33 -- here is the kinda tricky and ez part... all you do is set up what boosts what aka money
34 while wait(0.04) do -- alright this is the bignum part (hard part)
35 local svb = x.convert(money.Value) -- this converts your number to a bignumber mo.value = svb
36 local val = x.convert(1) -- this also converts your number to a bignumber val = 1
37
38 local val = x.mul(val,(x.add(x.mul(x.convert(multi.Value),{1.5,0}),{1,0}))) -- irst boost example, multi boosting 1.5x to cash.
39 -- you can add it any boost.. even to rebs... bu =t tahts odd lol
40
41 -- here is the place where we make our skill go up by auto, we dont have the data2 as we didj before since that was a bs formula.. it was CRAP...
42 svb = x.add(svb,val) -- svb= (in most bnum scripts) money
43 money.Value = x.bnumtostr(svb)
44 local sv = x.convert(skill.Value) -- nsskil in this case is NotShortenedSkill -- we can change it to skill tho
45 local valc = x.convert(5)
46 local valc = x.mul(valc,(x.add(x.mul(x.convert(money.Value),{0.1,-1}),{1,0}))) -- boost for skill, eg this gives literally hardly any boost.
47 local valc = x.mul(valc,(x.add(x.mul(x.convert(multi.Value),{0.235,1}),{1,0}))) -- boost for skill, eg this gives literally hardly any boost.
48 -- what i just did there wasidk how to explain it lol basically what i did ther was change the boosts and how it goes to power...
49 -- you can always change it to your liking but you dont need to...
50 -- now we need the formulae which is log10
51 sv = x.log10(x.add(sv,valc)) -- logging10 and doing the math to what our skill will be from [stat]
52 skill.Value = x.short(x.bnumtostr(sv)) -- getting our skill and simplyfying it, xshort = 1k, w/o that t would be 1000.
53 skill.Value = x.bnumtostr(sv) -- you can delete this but we recommend using nsskill for stuff like portals and etcetc
54 end
55end) -- dont forgotet to end this we dont want an inf loop which can cause all loads to shift -- sorry about that spellin mistake lool
56-- now we are at the bit where most devs absoloyte;yt forgot to edit... this is important as it ascynces it...
57game.Players.PlayerRemoving:Connect(function(plr) -- checks when the player has left/etc or if anything has happened and it rechecks everything,
58 --example stats, it finds if anything is bugged or not.
59 Data:SetAsync(tostring(plr.UserId),{ -- open bracket, put all stats INSIDE
60 plr.Stats.Money.Value, -- you dont needa purt skill in this as it auto calculates as you gain more stats!
61 plr.Stats.Multi.Value,
62 plr.Stats.Rebirth.Value,}) -- dont forget to end the bracket otherwise the function will not stop and wont be in the table!
63end) -- and finally dont forgoet the end the screipt off!
64
65-- Lets now give it a function >;D -- we can use this and make a full button sim tutorial but that would be a very long video... today is only on how to make data
66-- any issues contact Paint walls or ban#0759 on discord or through yt/comments or even roblox chat..
67-- i can help you anytime if im free... if howveer sometihng is wrong in this ds.. tell me instantly and ill try to fix the error... we can do an overhead gui connect as well
68-- if you somehow managae to kill the datatstore you can always reset datat store from here -- scroll up to datastore key and redo the key
69-- i will be linking etnum if i remember and i will be doing a video of hpw to connect overhead guis and stuff as well
70-- after you have done this DO NOT FORGET TO UNLOCK API SERVIECES! -- YOU CAN FIND IT ON THE HOME BAR AT STUDIOS THEN GO SETTINGS, FIND SECURITY AND ENABLE..
71-- if you do not do this this datastpore (keep in serverscript) cant access api which means the actual game cannot accept the dataload
72-- it blocks access of... if you do use etnum its the same way to config bnum... all you do its just change -- the x require bignu,m/etnum part..
73-- you needa have bignum kept in repstorage for safe measures (not needed if you have etnum) then keep (if you do have etnum) is serverscript.
74
75-- enjoy the datstore tutorial ;D