Problem With Script Level System

Hello,
I have created a leveling system that creates a folder under the player with “Ki, Level, XP, Etc.” Values, it’s for a dragon ball game!

I would like to make sure that if the player does not have for example 10 levels he cannot transform [the script] I mean if it is possible to do so.

Example: Level 10 Required For Random Form

My idea was to block the script with an “if” but I don’t know much how to do it,
1fd15cf550c7563c14426823570e2d4b858f002f
I hope you can help me!

Could you elaborate further on the issue, and what you have tried to rectify it?

I tried adding “if EXP.Value> = 100 then”

this is the script to equip the transformation,

I’m still confused as to what you’re attempting to accomplish here. What does EXP do in this scenario? Why do you need it?

I’m trying to get a required level in the game menu To Equip One Thing [anime transformation]

There is a button in my game menu.
To Equip A Thing [Anime Transformation]
I wish people can’t equip it if they don’t have a certain level.

Yes, I’ve already seen it.
But it does not work…

1 Like

do in that button, if player click, the game check the player EXP
i mean like

Button = Script.Parent
local Player = game.Players.LocalPlayer

Button.MouseButton1Click:Connect(function()
     if (Locate the player EXP here) >= (Number) then
          print(Player.Name..)
     end
end)

I hope it help!

You should do the “If” statement inside of a function :grinning:

Can you give me an example? I’m pretty confused …

Doesn’t seem to work …; (
im trying.

script.Parent.MouseButton1Click:Connect(function()
if EXP.Value >= 100 then
--can transform 
else
--can't transform
end
end)

I’m going to try, I’ll let you know if it works …

I just noticed that your local Player Is an Incomplete function, you should write this Instead:

local Player = game.Players.LocalPlayer

I’d also recommend you to look at the Developer Console (F9) for any errors after you press the button.

local Player = game.Players.LocalPlayer


script.Parent.MouseButton1Click:Connect(function()
    local EXP = Player.Stats.EXP
	If EXP.Value >= 100 then
    print("Works")
	Else
	print("Can't")
end
end)

It Doesn’t Work, This Is How The Player Is Organized.
image

My mistake! You shouldn’t use capital letters. Do “if” and “else”, sorry… :sweat_smile:

Not that important, but you can define the instance “EXP” variable outside the function.

Also, if the transformation is happening server sided, do check if the player has the required value before allowing the transformation.

Hey there i think this would help you

local Player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
     local XP = Player:WaitForChild("Stats").EXP
     if XP.Value >= 100 then
          print("Works")
     Else
          print("Can't")
     end
end)

Make sure this is local script

Not Working, Look At The Screenshot Of The Player Folders.