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

Leaderboard: Level can go over max level?

Asked by 5 years ago
Edited 5 years ago

I'm making where when a player goes over the level limit, it stops them at the max level you can be. I'm getting no errors whatsoever though, and the script won't work. Help?

--LOCAL SCRIPT--
local RS = game:GetService("ReplicatedStorage")
local remotef = RS.RemoteFunctions:WaitForChild("MaxyAssist")

local MV = remotef:InvokeServer(6000)
if game.Players.LocalPlayer.leaderstats.Level.Value >= (MV) then
    game.Players.LocalPlayer.leaderstats.Level.Value = (MV)
--SERVER SCRIPT--
function lV (player,levelMax)
    return levelMax
    end

    game.ReplicatedStorage:WaitForChild("RemoteFunctions").MaxyAssist.OnServerInvoke = lV
0
If you're using a LocalScript, why are you using OnServerInvoke? Also your script gives the client too much power. User#19524 175 — 5y
0
where is the part where it's supposed to prevent going above max level? I don't see any sort of restriction Vulkarin 581 — 5y

1 answer

Log in to vote
-1
Answered by 5 years ago

This should work.

--[[
    Normal script inside workspace
--]]
game.Players.PlayerAdded:Connect(funtion(plr) -- You can use something else instead of "plr".
    locals stats = instance.new("Model", plr) -- Change "stats" to whatever you want.
    stats.Name = "leaderstats" -- Do not change this except the "stats" part if you changed it up.

    local lvl = instance.new("IntValue", stats) -- Change "lvl" to anything.
    lvl.Name = "Level"
    lvl.Value = 1 -- This is the starting level, change it to anything you want.

    if lvl.Value > 6000 then
        lvl.Value = 6000
    end
end)
0
This is also the most known way to make leaderstats and max stats. DbExpress 20 — 5y
0
Actually my script works, but it's really delayed. InstantManager 27 — 5y
0
The if statement is only going to run one time, you need to connect it to the Changed event Vulkarin 581 — 5y
0
Fixed the delay in a different way, but thanks for trying to help. :) InstantManager 27 — 5y
Ad

Answer this question