I'm very confused right now. I have been working on a script for a store but there has been some trouble with the testing. Inside of studio, I use play solo and it works all fine. But when I do it in the Roblox player, it doesn't work. Please help me. Here is the full script.
local Player = game.Players.LocalPlayer.PlayerGui
local Store = Player.Store
-- Don't use parent just put the gui in StarterGUI
local StoreBut = Store.StoreBut
local MainBack = Store.MainBack
local Trails = Store.Trails
local Hats = Store.Hats
local Guns = Store.Guns
MainBack.HatsButton.MouseButton1Click:connect(function() -- Use MouseButton1Click
MainBack.Visible = false
Hats.Visible = true
end)
MainBack.SnipersButton.MouseButton1Click:connect(function() -- Use MouseButton1Click
MainBack.Visible = false
Guns.Visible = true
end)
MainBack.EffectsButton.MouseButton1Click:connect(function() -- Use MouseButton1Click
MainBack.Visible = false
Trails.Visible = true
end)
Hats.Exit.MouseButton1Click:connect(function()
Hats.Visible = false
MainBack.Visible = true
end)
Guns.Exit.MouseButton1Click:connect(function()
Guns.Visible = false
MainBack.Visible = true
end)
Trails.Exit.MouseButton1Click:connect(function()
Trails.Visible = false
MainBack.Visible = true
end)
Hats.Exit.MouseButton1Click:connect(function()
Hats.Visible = false
MainBack.Visible = true
end)
Guns.Exit.MouseButton1Click:connect(function()
Guns.Visible = false
MainBack.Visible = true
end)
MainBack.Exit.MouseButton1Click:connect(function()
MainBack.Visible = false
StoreBut.Visible = true
end)
StoreBut.TextButton.MouseButton1Click:connect(function()
MainBack.Visible = true
StoreBut.Visible = false
end)

2 comments
Even better, you can put a timeout value in the WaitForChild call, so it'll only wait however many seconds you give it and if it doesn't get anything by then it'll return nil.
@GoldenPhysics very true, but I think 5 seconds is already more than enough so in this case just leave it blank.