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

How to fix a XP system as Mad Game ?

Asked by 7 years ago

I would like create a XP system as Mad Game or as others games, but how to make?

Mon script who does not works correctly:

local player = script.Parent.Parent.Parent

local XP = player.leaderstats:WaitForChild("XP")
local Level = player.leaderstats:WaitForChild("Level")

XP.Changed:connect(function()
    if XP.Value < 200 then
        script.Parent.Frame.Frame.Frame:TweenSize(UDim2.new(0, XP.Value,0, 10),"Out","Quad",.5)
        script.Parent.Frame.XP.Text = XP.Value.." / 200 XP"
        return;
    elseif XP.Value < 201 then
        script.Parent.Frame.Frame.Frame:TweenSize(UDim2.new(0, 0,0, 10),"Out","Quad",.5)
        script.Parent.Frame.XP.Text = XP.Value.." / 400 XP"
        Level.Value = Level.Value+1
    end
    if XP.Value < 400 then
        script.Parent.Frame.Frame.Frame:TweenSize(UDim2.new(0, (XP.Value-200),0, 10),"Out","Quad",.5)
        script.Parent.Frame.XP.Text = XP.Value.." / 400 XP"
        return;
    elseif XP.Value < 401 then
        script.Parent.Frame.Frame.Frame:TweenSize(UDim2.new(0, 0,0, 10),"Out","Quad",.5)
        script.Parent.Frame.XP.Text = XP.Value.." / 800 XP"
        Level.Value = Level.Value+1
    end
    if XP.Value < 800 then
        script.Parent.Frame.Frame.Frame:TweenSize(UDim2.new(0, (XP.Value-600),0, 10),"Out","Quad",.5)
        script.Parent.Frame.XP.Text = XP.Value.." / 800 XP"
        return;
    elseif XP.Value < 801 then
        script.Parent.Frame.Frame.Frame:TweenSize(UDim2.new(0, 0,0, 10),"Out","Quad",.5)
        script.Parent.Frame.XP.Text = XP.Value.." / 1,600 XP"
        Level.Value = Level.Value+1
    end
    if XP.Value < 1600 then
        script.Parent.Frame.Frame.Frame:TweenSize(UDim2.new(0, (XP.Value-1400),0, 10),"Out","Quad",.5)
        script.Parent.Frame.XP.Text = XP.Value.." / 1,600 XP"
        return;
    elseif XP.Value < 1601 then
        script.Parent.Frame.Frame.Frame:TweenSize(UDim2.new(0, 0,0, 10),"Out","Quad",.5)
        script.Parent.Frame.XP.Text = XP.Value.." / 3,200 XP"
        Level.Value = Level.Value+1
    end
    if XP.Value < 3200 then
        script.Parent.Frame.Frame.Frame:TweenSize(UDim2.new(0, (XP.Value-3000),0, 10),"Out","Quad",.5)
        script.Parent.Frame.XP.Text = XP.Value.." / 3,200 XP"
        return;
    elseif XP.Value < 3201 then
        script.Parent.Frame.Frame.Frame:TweenSize(UDim2.new(0, 0,0, 10),"Out","Quad",.5)
        script.Parent.Frame.XP.Text = XP.Value.." / 6,400 XP"
        Level.Value = Level.Value+1
    end
end)
0
You need to provide us with more information. Why doesn't it work properly, are there any outputs if so, what do they say? Uroxus 350 — 7y

1 answer

Log in to vote
0
Answered by
tkcmdr 341 Moderation Voter
7 years ago
Edited 7 years ago

Hi NiniBlackJackQc,

I would encourage you to utilize the power of object-oriented programming to monitor your players' scores more efficiently. NumberValues are insecure and just plain messy. In addition, they are basically an alternative to proper programming.

Seen as your skills in programming are somewhat limited, I would like to encourage you to learn more efficient methods for programming by both reading the Lua manual in its entirety and also studying the ROBLOX Wiki extensively.

I know this is not the answer you expect and want, but you really would benefit if you improved your skills more. At the moment, you simply do not have the skills to match any Mad Studio title in terms of efficiency and play-ability. Consider this a wake up call; I hope it helps.

Have a wonderful day, NiniBlackJackQc, and best of luck as you continue learning to program.

Best regards, tkcmdr

Edit: Corrected embarrassing typo

Ad

Answer this question