Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I define a NumberValue in a leaderstats folder with a normal script(not a local script)?

Asked by 5 years ago

I'm making a simulator game and I need to define a Number Value called Strength in a folder called leaderstats in a normal script and not a local script. How do I define a certain players leaderstats folder and Strength Number Value?

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

It's a simple as:

-------Server Script

local Players = game:GetService("Players") 


Players.PlayerAdded:Connect(function(Player) ------Connect A function when A player Joins The Game
    if Player then
        local leaderstats = Instance.new("Folder", Player) ----Create a new Folder
        leaderstats.Name = "leaderstats"---- Give it a Name
        local NumberValue = Instance.new("NumberValue", leaderstats) -----Create a Value
        NumberValue.Name = "NumberValue" --- Give it a Name
    end
end)

Ad

Answer this question