So i need some help with leaderstats. The thing is i'm using the Move it simulator template. But my leaderstats aren't working. Even when i try to put them in ServerScriptService and StarterPlayer. But it didn't work, I need some help.
✓ ANSWER ACCEPTED
My leaderstats aren't working. Can you fix them?
1 answer
✓ Accepted answer
You didn't give any script for us to look at, and help you fix. Next time, make sure to send the script, so we can help you fix it. I'll just help you for now, but keep that in mind.
Here's how you would make a basic leaderstats script.
Step 1: Insert a script. You can make this script in ServerScriptService, or the Workspace.
Code: I highly recommend you really try to understand how the code works, by looking at it, and with my comments. If you just copy and paste the code, you're cheating yourself. Make sure to try to understand it, as it will be much better for you.
game.Players.PlayerAdded:Connect(function(Player) --makes a player added event, basically, whenever a player joins the game, this function should run, and also assign the player who joined to the Player parameter.
local Folder = Instance.new("Folder") --makes a folder using the Instance.new constructor function, and assigns it to the variable "Folder"
Folder.Name = "leaderstats" --Sets the name of the Folder. Note that it always has to be "leaderstats".
Folder.Parent = Player --Sets the parent, to the Player parameter, which will be a player when they join
--creating the first leaderstat
local Coins = Instance.new("IntValue") --creates an IntValue, to store the amount of leaderstats, which in this case is set to the coins variable.
Coins.Name = "Coins" --sets the name of the leaderstat
Coins.Value = 0 --sets the value of the leaderstat, (how many of it)
Coins.Parent = Folder --sets the parent, to the folder variable we made.
--how to add a second one, the same concept, except different variables, and names.
local Leaderstat2 = Instance.new("IntValue")
Leaderstat2.Name = "Leaderstat2"
Leaderstat2.Value = 10
Leaderstat2.Parent = Player
end)
Make sure to always show your code, next time. Hope I helped, and have a good day.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
can you show the script
Would help if you showed the script
Show the script please.