I am trying to make GUIs visible with values something like this
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local leaderstats = player:WaitForChild("toolLeaderstats")
local meelesButtons = script.Parent.Meeles.MeelesFrame
local gunsButtons = script.Parent.Guns.GunsFrame
local ClassicSwordButton = meelesButtons.ClassicSwordButton
local ClassicBombButton = gunsButtons.ClassicBombButton
local ToolValues = {
ClassicSword = leaderstats.ClassicSwordValue.Value, meelesButtons.ClassicSwordButton,
ClassicBomb = leaderstats.ClassicBombValue.Value, gunsButtons.ClassicBombButton
}
for ToolValueName, ToolValueCheck in pairs(ToolValues) do
if ToolValueCheck >= 1 then
--Now I am trying to make the GUI visible--
print(ToolValueName.." is open")
end
end
It works for the value but I dont have any idea how I could add the GUI here.
1 Like
yes the problem is getting the value of the who got >= 1
if ToolValueCheck >= 1 then
if is the ClassicSword then make it visible if is the ClassicBomb then make it visible too
print(ToolValueName.." is open")
is here any way to add the GUI inside the table and use it?
1 Like
Ok nvm it works but I only have one problem
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local leaderstats = player:WaitForChild("toolLeaderstats")
local meelesButtons = script.Parent.Meeles.MeelesFrame
local gunsButtons = script.Parent.Guns.GunsFrame
local ToolValues = {
ClassicSword = leaderstats.ClassicSwordValue.Value,
ClassicBomb = leaderstats.ClassicBombValue.Value,
}
ToolGuis = {
ClassicSwordGUI = {gui = meelesButtons.ClassicSwordButton, guiLock = meelesButtons["ClassicSwordTool(Lock)"]},
ClassicBombGUI = {gui = gunsButtons.ClassicBombButton, guiLock = gunsButtons["ClassicBombTool(Lock)"]}
}
for ToolValueName, ToolValueCheck in pairs(ToolValues) do
print(ToolValueName, ToolValueCheck)
if ToolValueCheck >= 1 then
for GuiVisible, GuiLock in pairs(ToolGuis) do
GuiLock.gui.Visible = true
GuiLock.guiLock.Visible = false
print("open".. GuiVisible)
end
end
end
When one GUI is unlocked other will be unlocked idk why

I only want to set the guis visible with value >= 1 (classicSword was with 1 and classicbomb was with 0 soo ClassicSwordGUI will be visible and the classicbomb not)
2 Likes