So I've been making a Zombie Shooter FPS game, and been trying to get a level system to function to no avail due to my scripts not focusing on a level system but rather focusing on in-game currency drops for better weapons(I know error on my part), but I've been doing some thinking and though "What if a player touches a brick, it takes a certain amount of currency from them, and levels them up accordingly".
Sadly, I have no the sweetest clue as to how to go about coding this, and it may sound dumb on my end, but I do not know. I've done some research and found a code I'll put below. My currency is "DiamondDollors" and I was thinking that an increase of "100" DiamondDollors for every level would be suffice.
Example; Level 1 - 0 DiamondDollors Level 2: 100 DiamondDollors Level 3: 200 DiamondDollors Level 4: 300 DiamondDollors etc...
Here's some code I found to change the stat, but I wasn't planning on using it, it's the closest idea to what I'm trying to do if it helps any of you maybe better understand!
local part = script.Parent -- Variable for the part which the character is going to touch.
part.Touched:connect(function(hit) -- An anonymous function(Hope you know how to make one)
local hum = hit.Parent:WaitForChild("Humanoid") -- Variable to confirm it's a humanoid that touches that part.
if hum then -- If statement(Hopefully you know how to make one)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent) -- Variable for player using :GetPlayerFromCharacter() method.
plr.leaderstats.GameMode.Value = "Normal" -- Changes the value of the StringValue
end
end)
Thank you all, any help is appreciated!

1 comment
Sort of. Like a level system, but instead of using XP, it uses cash. And it only occurs when a player touches a brick in the map instead of auto occuring. And that brick takes the correct amount of DiamondDollors from the players account if they have it and changes their level accordingly.