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

Gui is working inside of studio but it isn't work when i play the actual game?

I apologize if there's a rule about posting too much, this is only my second post but yeah. So i recently learned how to make a Gui and i made a simple one for now just so i know for the future the basics of making one. And i tested it in Roblox Studio test and it work's flawlessly. But then i tried it in game and it didn't work? Maybe someone knows why? Not sure if it's my script. But here's my script. Super weird that it's not working.


local button = script.Parent
local frame = script.Parent.Parent.Frame


button.MouseButton1Click:connect(function()
	if button.Text == "BackPack" then
		frame.Visible = true
		button.Text = "Close"
	elseif button.Text == "Close" then
		frame.Visible = false
		button.Text = "BackPack"
	end
end)

Hopefully someone can help me figure out my problem. Not sure why the script isn't showing up on here i tried it like 5 different ways. Anyways heres a picture of the script http://imgur.com/6r9l2du

3 comments

0

Try "MouseButton1Down"

0

Add a "wait()" in the beginning, maybe you're not giving the script enough time to load.

0

Adding a wait worked thank you!

1 answer

✓ Accepted answer

Try this:

local Button = script.Parent
local Frame = script.Parent.Parent.Frame

Button.MouseButton1Click:Connect(function()
	if Button.Text == "BackPack" then
		Frame.Visible = true
		Button.Text = "Close"
	else
		Frame.Visible = false
		Button.Text = "BackPack"
	end
end)

1 comment

0

Still doesn't work. I tried publishing it to a new place rather than my old place in hopes that the old place was glitched but nope. Script still won't work.

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