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

Open and close functions don't work?

Asked by 4 years ago

This is the script I have, but it doesn't do anything.

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Visible = false
    script.Parent.Parent.Parent.TextButton.Visible = true
end

I tried in a normal script, and a LocalScript but neither work. Thank you in advance. I'm pretty new to scripting with GUIs so if this is kind of an obvious question and/or fix, that's why.

1 answer

Log in to vote
0
Answered by 4 years ago

You're trying to connect and do a function at the same time. I rewrote this script for you, it should look something more like

function MouseButton1Click(x,y)
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.TextButton.Visible = true
end
script.Parent.MouseButton1Click:connect(MouseButton1Click)

Basic structure for opening and connecting functions is

function FunctionName (FunctionParameters) --Parameters can differ, usually are numbers or something that represents numbers, like wait(5) waits for 5 units-- 
WHATTHEFUNCTIONDOES
end

INPUT:connect(FUNCTIONNAME) --Input as in what triggers it to what connects it--

0
Thanks for your help! co_existance 141 — 4y
Ad

Answer this question