Today I made my first (useful) GUI's, including a button that opens a list of items that could be copied into the player's backpack. Somehow, I can easily use the GUI while I'm in the studio, but the button does absolutely nothing when I try to play my game. Could someone please explain this?

local frame = script.Parent.Parent.ScrollingFrame
local frameOpen = false

function onMouseEnter()
	script.Parent.BackgroundColor3 = Color3.new(0.7, 0.7, 0.7)
end

function onMB1Click()
	script.Parent.BackgroundColor3 = Color3.new(0.6, 0.6, 0.6)
	wait(.07)
	script.Parent.BackgroundColor3 = Color3.new(0.7,0 .7,0 .7)
	if frameOpen == false then
		frame.Visible = true
		frame.Active = true
		frameOpen = true
	else
		frame.Active = false
		frame.Visible = false
		frameOpen = false
	end
end

function onMouseLeave()
	script.Parent.BackgroundColor3 = Color3.new(1, 1, 1)
end


script.Parent.MouseEnter:connect(onMouseEnter)
script.Parent.MouseButton1Click:connect(onMB1Click)
script.Parent.MouseLeave:connect(onMouseLeave)

2 comments

0

Make sure it's a localscript

0

It is a LocalScript. :c