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

How would i reference a leaderstat?

Asked by 3 years ago
Edited 3 years ago

The script im trying to run is:

local Player = game.Players.LocalPlayer
local Leaderstat = Player:WaitForChild("leaderStats")
local stat = Leaderstat["strength"]

if Leaderstat.strength.value = 100 then
    Player.leaderstats.Level.value = Player.leaderstats.Level.value +1
end

What i'm trying to do is when the payers strength reaches an amount, 100 in this case, I want their level to go up. When i run the game and use a tool,i made it so it instantley gets me to 100 for now, to get to 100 the level doesn't change.

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

This is very incorrect. I can polish it up for you. There is too much that I can explain here so I will only type my stuff.

game.Players.PlayerAdded:Connect(function(player)
    local ls = Instance.new("Model",player)
    ls.Name = "leaderstats"
    local stat1 = Instance.new("IntValue",ls)
    stats.Name = "Strength"
    local stat2 = Instance.new("IntValue",ls)
    stat2.Name = "Level"
    stat2.Value = 1
    local buildup = 1
    if stat1.Value = 100 * buildup then
        stat2.Value = stat2.Value + 1
        --Customize buildup gain which ever way you want or just use this system.
        buildup = buildup + 1
    end
end)
0
on line 10 its has error line under the = and the then D3M0NIC_PLAYZ 2 — 3y
0
it's just a syntax error, make it == and it should work OfficerBrah 494 — 3y
Ad

Answer this question