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

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

Asked by 6 years ago

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

0
Is this a LocalScript? it should be a LocalScript Pejorem 164 — 6y

1 answer

Log in to vote
0
Answered by
Viking359 161
6 years ago
Edited 6 years ago

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)
0
remove the : on line 6 Viking359 161 — 6y
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 Mohawkid14 28 — 6y
0
Try it again, i edited my answer. Also, when you remove the if statement, make sure to remove everything after the else, too. Viking359 161 — 6y
0
Thanks so much! Mohawkid14 28 — 6y
Ad

Answer this question