Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

GUI is showing new tabs in studio, but not in the Player?

Asked by
thezube 10
8 years ago

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)

1 answer

Log in to vote
0
Answered by
soved 69
8 years ago
Edited 8 years ago

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!
0
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 474 — 8y
0
@GoldenPhysics very true, but I think 5 seconds is already more than enough so in this case just leave it blank. soved 69 — 8y
Ad

Answer this question