So I'm making a script that is FE it will turn a player gui off/on. It works in roblox studio but it doesn't work for in-game. I see this is console when I click it "Infinite Yield Possible on 'Players.iRexBot.PlayerGui:WaitForChild("ShopGui")" Can anyone possibly fix it?
local Storage = game:GetService('ReplicatedStorage') local OpenEvent = Storage:WaitForChild('OpenShop') --Core function onFired(player, status) local playergui = player:WaitForChild('PlayerGui') local Shop = playergui:WaitForChild('ShopGui') local Frame = Shop:WaitForChild('ShopFrame') local Button = Shop:WaitForChild('OpenShop') if Frame.Visible==true then print('Opened') Frame.Visible=false elseif Frame.Visible==false then print('Closed') Frame.Visible=true end end OpenEvent.OnServerEvent:Connect(onFired)
Heres Something you could do instead First make a Text Button in your frame Then A Script in that Text Button after Putting it where you want and resizing it You write in the script:
script.Parent.MouseButton1Click:connect(function(player) local PlayerButton = player.PlayerGui.ScreenGui.Frame.TextButton local TargetFrame = PlayerButton.Parent.Parent.TargetFrame
if TargetFrame.Visible == false then TargetFrame.Visible = true PlayerButton.Text = "Close TargetFrame" else TargetFrame.Visible = false PlayerButton.Text = "Open TargetFrame" end
end)