Here's the script, I'm not sure what exactly is wrong. Thank you in advance if you help :)
local guiname = "MainUI" local guiname2 = "ShopButtons" script.Parent.Touched:connect(function(hit) if hit == nil then return end if hit.Parent == nil then return end local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player ~= nil then if player:FindFirstChild("PlayerGui") then if not player.PlayerGui:WaitForChild(guiname) then local ui = player.PlayerGui:WaitForChild(guiname).Pets local ui2 = player.PlayerGui:WaitForChild(guiname).guiname2 wait(.1) ui.Open.Value = true ui2.Open.Value = false ui:TweenPosition(UDim2.new(.225,0,.225,0),"In","Bounce",1,true) ui2:TweenPosition(UDim2.new(.27,0,-1.1,0),"Out","Bounce",1,true) end end end end)
I have a GUI that once clicked opens a Pet frame (aka local ui) When I clicked it, it did nothing.
You made a mistake at line 11
It should be
if player.PlayerGui:WaitForChild(guiname) then
Instead of
if not player.PlayerGui:WaitForChild(guiname) then