A couple of things wrong with your code, first there is no event listener, meaning that this script will only run once and thats it, even if your Storage1 value changes to more than 150 nothing will happen as the script already ended long before that, you can use the .Changed event so that whenever storage1 value changes, it will check if its more than 150
Secondly, setting the parent of the gui is not done by indicating Strings, you have to indicate the parent as an object. Ill show you what i mean in the code.
local Storage = game.Workspace:WaitForChild("Storage1")
local Storage1 = game.Workspace.Storage1
local MaxValue = 150
local Gui = script.Parent.Main.SellGui
if(Storage1.Value >= 150) then
Gui:Clone()
Gui.Parent = "StarterGui"
while true do
wait()
end
end
Also i am not sure if you know this but you should put the gui into playerGuis instead if you want the player to see the gui immediately, Startergui only works when the player joins the game, or respawns
local Storage = game.Workspace:WaitForChild("Storage1")
local MaxValue = 150
local Gui = script.Parent.Main.SellGui
Storage.Changed:Connect(function()
if(Storage1.Value >= 150) then
local ClonedGUI = Gui:Clone()
ClonedGUI.Parent = game.StarterGui
while true do
wait()
end
end
end()
2 comments
It's a normal script
Where is the script located at?