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

GUI works in studio, not in game?

Asked by
funyun 958 Moderation Voter
9 years ago

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)
0
Make sure it's a localscript Goulstem 8144 — 9y
0
It is a LocalScript. :c funyun 958 — 9y

Answer this question