Stat System with a GUI, Savable

Hey guys

I’m developing a game right now, but i am stuck on the stats system. I have absolutely no idea where to start.
I want my stat system to be like those one piece games. When you level up, you get points then you can add them to Speed, strenght for example.
I have looked on youtube, but didn’t really find a good tutorial/guide. Only premade models, which i don’t like to use. And i have no idea on how to edit them for my game.
I want to make in a GUI too. But GUIs is something i haven’t done before.
Even if i managed to make a DataStore, i still have no idea on GUIs and how to increase stats by using points.

If someone can link me a vid or a guide, that would be highly appreciated. Or if u can explain yourself, it’s up to you.

My stat system will be:
-Strenght
-Speed(max 150)
-Mind Control
-Defense

-Kills
-Money

It’s something i have been looking into for days, i don’t like to ask questions on here. But sometimes it has to be done.

kind regards
XYZLambda

Please read this because it’s very important,

Alright so your not gonna learn anything by telling people to make scripts for you here that you can copy and paste into your game, you should know how to make them yourself because that’s WAY better, take that as feedback.

Additionally this category is not created for this purpose, the purpose is helping you on fixing problems with your scripts.

If you feel like that you can not do that now go and keep learning more stuff and eventually you will find a way to make it once you have enough knowledge on how to exactly make that specifc thing you will learn how to do it naturally without anyone holding your hands, you shouldn’t just jump straight to it without learning the essential things that you need to know to make that specific thing.

That way you know exactly how it works and how to do it and you will be way satisified with the results and the fact that you made it yourself.

That’s way better instead of just copy and pasting scripts from random people without even knowing what each line of code does, that’s not learning at all, go to the Roblox API Reference and learn what you need just absorb as much knowledge from it as you can, that’s one way of learning how to code, you can go to it directly by clicking this link: Roblox Developer API Reference - Extremely Useful Learning Resource

Thank you for your understanding. :slightly_smiling_face:

3 Likes

i am not asking anyone to make a script, im asking to provide a link to a vid or guide.
I put in bold aswel…

It doesn’t mean i don’t know how to exactly do that, that idk how to code. I spent 2 days fixing my last problem. You would know that if u saw my last topic. That’s the way i learn. I challenge myself. I NEVER COPY-PASTE SCRIPTS. Everyone has it’s own way of learning. Some people start with the very basics, which i already know, and others learn the basics by doing them in harder stuff. ME!
Everything i typed in my scripts right now in my game, i understand. And i’m certain if i can find a good guide ill understand the thing im trying to make too.

So again, i clearly state

If someone can link me a vid or a guide, that would be highly appreciated. Or if u can explain yourself, it’s up to you.

I never mentioned, if someone can make me a script. So i am in the right catagory and there’s nothing wrong with my question.

And you said

you should know how to make them yourself because that’s WAY better.

If i knew how to do it, i wouldn’t ask for help
I mean isn’t that the sole purpose of this forum…to ask questions?

So as far as i know im in the correct catagory.
Help and feedback…I need help, scripting support…I need help with scripting.

And if im really wrong, and if i am that’s totally ok. But if im wrong…then my question will be deleted.
But for now any link to a vid or guide is welcome!

And if no one can find or want to provide links, that’s fine…cuz u will see i will find my answer and i will post my answer here. Just like last time. Idc how long it takes.

Thank you for your understanding :slight_smile:

kind regards
XYZLambda

2 Likes

So i got it working.

It was easier than i thought. the hard part for me was making the DataStore, but after a couple hours of watching vids and reading guides. I got one working. And yes i do understand it actually.
And apparently making a GUI is so easy. Didn’t even need to watch a vid for it.
The only thing i basically had to do was to make sure it saved on the server, that was quite easy to do. But then i realised it wasn’t showing on the client. So a simple 4 lined local script fixed that.

I am sure it isn’t the best, but it does its job. So i’m glad.

DataStore script:

local DataStoreService = game:GetService("DataStoreService")

local DS = DataStoreService:GetDataStore("__Data__")

local statsGui = game.StarterGui:FindFirstChild("stats")

local event = game:GetService("ReplicatedStorage").Stats

game.Players.PlayerAdded:Connect(function(plr)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = statsGui
	
	
	event.OnServerEvent:connect(function(plr, label)
		while wait() do
			label.Text = "strenght: ".. leaderstats:FindFirstChild("Strenght").Value
		end
	end)

	
	local strenght = Instance.new("IntValue")
	strenght.Name = "Strenght"
	strenght.Parent = leaderstats
	
	
	
	local data
	local succes, errormsg= pcall(function()
		data = DS:GetAsync(plr.UserId.."-strenght")
	end)
	
	if succes then
		strenght.Value = data
		print("Saved!")
	else
		warn(errormsg)
		print("Something went wrong, not saved!")
	end
end)

game.Players.PlayerRemoving:Connect(function(plr)
	
	local succes, errormsg = pcall(function()
		wait()
		DS:SetAsync(plr.UserId.."-strenght", statsGui.leaderstats:WaitForChild("Strenght").Value)
	end)
	
	if succes then
		print("player Data Saved!")
	else
		print("Error, Not Saved")
		warn(errormsg)
	end
end)

Event local script this is needed to update the client:

local event = game:GetService("ReplicatedStorage").Stats
local label = script.Parent

while wait()do
	event:FireServer(label)
end

So all i need to do now is add the other stats and that’s done, for now atleast.

1 Like

in line

label.Text = "strenght: ".. leaderstats:FindFirstChild("Strenght").Value

Change “FindFirstChild” to “WaitForChild”

Where would I put this local script? In starter player scripts or in starter gui?