What do I want to achieve? I want to make it to where you can buy better clickers in a simulator game I am trying to make.
What is the issue? I am not really sure how I would do this because I am new to developing and don’t understand how to do some things. This is the script that already has a rebirth multiplier for when I add that in. I want to add the better clickers to take affect here.
All of that script is on one line in roblox studio.
What solutions have you tried so far? I have tried looking on YouTube and The devforum for solutions but I have not found any.
I’m sorry if this is a sloppy post. This is my first time posting on the dev forum. If this should be in a different category or I could make this more clear, please tell me.
My personal method would be to keep a StringValue in the player’s leaderstats which has the Value of their current clicker.
Then when they buy a clicker, this Value is changed.
When adding points, access a ModuleScript containing the clicker data and index the Player’s current clicker.
Now you can grab the amount it gives and other data etc.
Here’s an example:
--// Script, ServerScriptService
local ClickerData = require(script.ModuleScript);
--// When rewarding points
local Leaderstats = Player.leaderstats;
local PlayerData = ClickerData[Leaderstats.Clicker.Value];
Leaderstats.Points.Value = Leaderstats.Points.Value + (PlayerData.Amount * (Leaderstats.Rebirths.Value + 1));
Oh ok. I have been watching some videos talking about leaderstats and they have been making an instance.new code run for leaderstats and everything that goes in it.
Put your “CloneScript” in ServerScriptService and you should be good.
Actually just saw another correction, replace your current code with this:
local leaderstats = game.ServerStorage:WaitForChild("leaderstats")
game.Players.PlayerAdded:Connect(function(player) --//Player is automatically passed in when players join
leaderstats:Clone().Parent = player
end)
Ok, thanks for the help. This is my first real game I’m trying to make and I just watched youtube videos to figure out how to implement codes. Now that you have showed me this easier way to do this, I think I will start over because I haven’t made much progress with the game and my scripts are a mess with hard ways to do things. Thanks for the help! I just need to reorganize things so I can Implement new things into my code easier
I actually just made that and what I did is added the value to the PlayerGui. So each upgrade by clicking a button fires a client event which makes the server go to the PlayerGui of that particular player and multiplies/adds value.