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)
I am very confused of what this is supose to be doing... But if I were you I would use :WaitForChild() pretty much all of the time.
Example:
-- //DO NOT USE THIS local WS = game:GetService("Workspace") local Part = WS.Part -- VERY WRONG! -- //BUT USE THIS METHOD local WS = game:GetService("Workspace") local Part = WS:WaitForChild("Part") -- Perfect!