I'm using a car dealership scipt, and my initial leaderstats script (pictured 1st), is the one that I want to manage the dealership (with Money being the only factor), and the bottom script is the leaderstats script from the Dealership model. Thank you for your help
#Help with Leaderstats script
49 messages · Page 1 of 1 (latest)
Can add more stats to this like coins, levels, anything you want just change where it says examples and follow that format to create more (or delete it), then i have money defaulted to 6500 if the player doesnt have data yet, and another example one incase you want to add more, you can delete if you dont need it
local playerDataStore = DataStoreService:GetDataStore("Dealership")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local values = {}
for _, name in ipairs({"Money", "EXAMPLE"}) do
local value = Instance.new("IntValue")
value.Name = name
value.Parent = leaderstats
values[name] = value
if value.Name == "Money" then
value.Value = 6500
--elseif value.Name == "EXAMPLE" then
--value.Value = NUMBER
end
end
local success, data = pcall(function()
return playerDataStore:GetAsync(player.UserId)
end)
if success and data then
for name, value in pairs(values) do
value.Value = data[name] or 0
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local values = {}
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
for _, value in ipairs(leaderstats:GetChildren()) do
if value:IsA("IntValue") then
values[value.Name] = value.Value
end
end
playerDataStore:SetAsync(player.UserId, values)
end
end)```
you have to delete where it says examples if you dont want those extra ones
alright so that script fixed the leaderstats, but now I have seperate issue with the script that the leaderstats one calls to
this script is super long so i'm going to put it into pastebin if thats alright
i think the issue with it is the beginning of the script that calls to bank data and wallet data
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
** You are now Level 1! **
i'm not good with saving anything other than numbers sorry
its alright thank you though
What is the problem, exactly?
Well the script that handles the spawning of cars still relies on the old script which uses Bank Data and Wallet Data which aren't the stats that i want to be used (money)
bruh its simple to save other things than a NumberValue
u need a DataStore to store other things
i honestly just do not know how to do that
ive never had to so i never looked into it
im a terrible scripter and its confusing to me
same ong
bruh im going to create one for u then
lol jk i have a friend that does the scripts for me
Roblox is a global platform that brings people together through play.
this script handles the spawning of the cars
but it doesn't correlate to my leaderstats so all i need help with is converting it sort of?
its a DataStore system that handles String, Bools, Number, Int and DoubleConstrainedValues
so did u check the DataStore system my friend made me
i was doing some other things i'll check it rn
also he does things that have tips on what it does
im going to work on this tomorrow because for now, i can't get it working and it's getting late
thank you for your help i'll let you know tomorrow if it works for me 😄
lol it took him 3 minutes to create that script
could not it to work 🤣
what does that mean
get it to work
** You are now Level 2! **
idk wtf i was typing
so what are u using
i'm using this one
that one worked for leaderstats but i don't know how to implement it into this script
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
bruh just modify his to fit for ur game
ok good i just refixed it
@clear oak
okay putting it in rn
all i did was remodified it as he told me since im still new also
but everything is added to the folder
if u want to add new things to the Folder in the Handler just lua local Handler = { ['Folders'] = { {key = 'leaderstats'}, {key = 'NewName'} -- creates a new folder to the newFolder handler function }, ['ls'] = { {key = 'Cash',Value = 0}, {key = 'Hommie',Value = 0}, {key = 'Nerd',Value = 0}, {key = 'Rebirth',Value = 0} }, ['newValues'] = { {key = 'Name',Value = 0}, }, -- same as the ls }
thank you