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

How might I make this simple and less sloppy?

Asked by 7 years ago
local player = game.Players.LocalPlayer
local b2 = player.PlayerGui:WaitForChild("MainUI").Img.Holder.Holder.b2
local c3 = player.PlayerGui:WaitForChild("MainUI").Img.Holder.Holder.c3
local d4 = player.PlayerGui:WaitForChild("MainUI").Img.Holder.Holder.d4
local e5 = player.PlayerGui:WaitForChild("MainUI").Img.Holder.Holder.e5
local f6 = player.PlayerGui:WaitForChild("MainUI").Img.Holder.Holder.f6
local g7 = player.PlayerGui:WaitForChild("MainUI").Img.Holder.Holder.g7
local h8 = player.PlayerGui:WaitForChild("MainUI").Img.Holder.Holder.h8
local i9 = player.PlayerGui:WaitForChild("MainUI").Img.Holder.Holder.i9
local j10 = player.PlayerGui:WaitForChild("MainUI").Img.Holder.Holder.j10
local k11 = player.PlayerGui:WaitForChild("MainUI").Img.Holder.Holder.k11
local l12 = player.PlayerGui:WaitForChild("MainUI").Img.Holder.Holder.l12

function unlock()
    if player.Lvl.Value == 2 then
    b2.Img.Visible = false
    b2.TextButton.LocalScript.Disabled = false
     elseif player.Lvl.Value == 3 then
    c3.Img.Visible = false
    c3.TextButton.LocalScript.Disabled = false
    b2.Img.Visible = false
    b2.TextButton.LocalScript.Disabled = false
     elseif player.Lvl.Value == 4 then
    d4.Img.Visible = false
    d4.TextButton.LocalScript.Disabled = false
    c3.Img.Visible = false
    c3.TextButton.LocalScript.Disabled = false
    b2.Img.Visible = false
    b2.TextButton.LocalScript.Disabled = false
     elseif player.Lvl.Value == 5 then
    e5.Img.Visible = false
    e5.TextButton.LocalScript.Disabled = false
    d4.Img.Visible = false
    d4.TextButton.LocalScript.Disabled = false
    c3.Img.Visible = false
    c3.TextButton.LocalScript.Disabled = false
    b2.Img.Visible = false
    b2.TextButton.LocalScript.Disabled = false
     elseif player.Lvl.Value == 6 then
    f6.Img.Visible = false
    f6.TextButton.LocalScript.Disabled = false
    e5.Img.Visible = false
    e5.TextButton.LocalScript.Disabled = false
    d4.Img.Visible = false
    d4.TextButton.LocalScript.Disabled = false
    c3.Img.Visible = false
    c3.TextButton.LocalScript.Disabled = false
    b2.Img.Visible = false
    b2.TextButton.LocalScript.Disabled = false
     elseif player.Lvl.Value == 7 then
    g7.Img.Visible = false
    g7.TextButton.LocalScript.Disabled = false
    f6.Img.Visible = false
    f6.TextButton.LocalScript.Disabled = false
    e5.Img.Visible = false
    e5.TextButton.LocalScript.Disabled = false
    d4.Img.Visible = false
    d4.TextButton.LocalScript.Disabled = false
    c3.Img.Visible = false
    c3.TextButton.LocalScript.Disabled = false
    b2.Img.Visible = false
    b2.TextButton.LocalScript.Disabled = false
     elseif player.Lvl.Value == 8 then
    h8.Img.Visible = false
    h8.TextButton.LocalScript.Disabled = false
    g7.Img.Visible = false
    g7.TextButton.LocalScript.Disabled = false
    f6.Img.Visible = false
    f6.TextButton.LocalScript.Disabled = false
    e5.Img.Visible = false
    e5.TextButton.LocalScript.Disabled = false
    d4.Img.Visible = false
    d4.TextButton.LocalScript.Disabled = false
    c3.Img.Visible = false
    c3.TextButton.LocalScript.Disabled = false
    b2.Img.Visible = false
    b2.TextButton.LocalScript.Disabled = false
     elseif player.Lvl.Value == 9 then
    i9.Img.Visible = false
    i9.TextButton.LocalScript.Disabled = false
    h8.Img.Visible = false
    h8.TextButton.LocalScript.Disabled = false
    g7.Img.Visible = false
    g7.TextButton.LocalScript.Disabled = false
    f6.Img.Visible = false
    f6.TextButton.LocalScript.Disabled = false
    e5.Img.Visible = false
    e5.TextButton.LocalScript.Disabled = false
    d4.Img.Visible = false
    d4.TextButton.LocalScript.Disabled = false
    c3.Img.Visible = false
    c3.TextButton.LocalScript.Disabled = false
    b2.Img.Visible = false
    b2.TextButton.LocalScript.Disabled = false
     elseif player.Lvl.Value == 10 then
    j10.Img.Visible = false
    j10.TextButton.LocalScript.Disabled = false
    i9.Img.Visible = false
    i9.TextButton.LocalScript.Disabled = false
    h8.Img.Visible = false
    h8.TextButton.LocalScript.Disabled = false
    g7.Img.Visible = false
    g7.TextButton.LocalScript.Disabled = false
    f6.Img.Visible = false
    f6.TextButton.LocalScript.Disabled = false
    e5.Img.Visible = false
    e5.TextButton.LocalScript.Disabled = false
    d4.Img.Visible = false
    d4.TextButton.LocalScript.Disabled = false
    c3.Img.Visible = false
    c3.TextButton.LocalScript.Disabled = false
    b2.Img.Visible = false
    b2.TextButton.LocalScript.Disabled = false
     elseif player.Lvl.Value == 11 then
    k11.Img.Visible = false
    k11.TextButton.LocalScript.Disabled = false
    j10.Img.Visible = false
    j10.TextButton.LocalScript.Disabled = false
    i9.Img.Visible = false
    i9.TextButton.LocalScript.Disabled = false
    h8.Img.Visible = false
    h8.TextButton.LocalScript.Disabled = false
    g7.Img.Visible = false
    g7.TextButton.LocalScript.Disabled = false
    f6.Img.Visible = false
    f6.TextButton.LocalScript.Disabled = false
    e5.Img.Visible = false
    e5.TextButton.LocalScript.Disabled = false
    d4.Img.Visible = false
    d4.TextButton.LocalScript.Disabled = false
    c3.Img.Visible = false
    c3.TextButton.LocalScript.Disabled = false
    b2.Img.Visible = false
    b2.TextButton.LocalScript.Disabled = false
     elseif player.Lvl.Value == 12 then
    l12.Img.Visible = false
    l12.TextButton.LocalScript.Disabled = false
    k11.Img.Visible = false
    k11.TextButton.LocalScript.Disabled = false
    j10.Img.Visible = false
    j10.TextButton.LocalScript.Disabled = false
    i9.Img.Visible = false
    i9.TextButton.LocalScript.Disabled = false
    h8.Img.Visible = false
    h8.TextButton.LocalScript.Disabled = false
    g7.Img.Visible = false
    g7.TextButton.LocalScript.Disabled = false
    f6.Img.Visible = false
    f6.TextButton.LocalScript.Disabled = false
    e5.Img.Visible = false
    e5.TextButton.LocalScript.Disabled = false
    d4.Img.Visible = false
    d4.TextButton.LocalScript.Disabled = false
    c3.Img.Visible = false
    c3.TextButton.LocalScript.Disabled = false
    b2.Img.Visible = false
    b2.TextButton.LocalScript.Disabled = false
end
end

game.Players.LocalPlayer.Lvl.Changed:connect(unlock)
unlock()

told you it's sloppy. Please don't hate.

0
use for loops abnotaddable 920 — 7y
0
there is a way to make this less sloppy (folders for each level) however not only with this script. F4ULT1NTH3D4T4 226 — 7y
0
Use for loops, and tables YTRaulByte 389 — 7y

Answer this question