Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My script should work but its not working, its about the textbutton, can anyone help?

my script is a script that goes in a textbutton and when you click on that button it pops up a gui.

heres my script:

local shopgui = Workspace.ShopGui
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
    shopgui:Clone().Parent = player.PlayerGui
end)

Its not showing everything. I need help

1 comment

0

Is this a LocalScript? it should be a LocalScript

1 answer

✓ Accepted answer

Make sure this is in a local script.

local shopgui = Workspace.ShopGui:Clone()
local player = game.Players.LocalPlayer
local playergui = player.PlayerGui
script.Parent.MouseButton1Click:Connect(function()
  if playergui:FindFirstChild("ShopGui") ~= nil then--this makes sure you dont have duplicates
wait(0)
else
shopgui.Parent = playergui
end)

without the if statement

local shopgui = Workspace.ShopGui:Clone()
local player = game.Players.LocalPlayer
local playergui = player.PlayerGui
script.Parent.MouseButton1Click:Connect(function()
shopgui.Parent = playergui
end)

4 comments

0

remove the : on line 6

0

I tried that. Every time i click on that button when the gui is visable it keeps adding more color to it because it transparency. but if i disable it and click the button nothing pop ups. Every textbutton and labels are in my frame. and yes i put it in a local script

0

Try it again, i edited my answer. Also, when you remove the if statement, make sure to remove everything after the else, too.

0

Thanks so much!

This discussion is preserved as it was. New answers, comments, and votes are closed.