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

Scrip Working in Studio and not in game?

Asked by
22To 70
9 years ago

Ok so this is a script to open the gui, it works perfectly in studio but when in game it wont work

function die()
script.Parent.Parent.Holder.Visible = true
script.Parent.Visible = false 
end

script.Parent.MouseButton1Down:connect(die)
0
"Holder?" RolandStudio 115 — 9y
0
thats the name of the frame 22To 70 — 9y
0
is the script a localscript? F_lipe 135 — 9y

3 answers

Log in to vote
1
Answered by
Uroxus 350 Moderation Voter
9 years ago

Though what mosski123 posted should actually work, it does not give the ability to close the GUI. (I assume if you want to open it, at somepoint it would have to be closed?)

This script would go inside the button and local holder should be linked to where ever holder is.

I don't quite know why in your example you have set the visibility of the button to falsebut the holder set to true, but if what I have done is not what you're after then it's easy enough to change!

If this answered your question, please click the 'Accept answer' box on the right -> If this does not work, please do tell me and if you'd like an explanation to how this works please do ask!

local holder = ----- 
script.Parent.MouseButtton1Click:connect(function()
    if holder.Visible == false then
        holder.Visible = true
    elseif holder.Visible == true then
        holder.Visible = false
    end
end
Ad
Log in to vote
0
Answered by
awfulszn 394 Moderation Voter
9 years ago
local Holder = script.Parent.Parent.Holder

script.Parent.MouseButton1Click:connect(function()
     Holder.Visible = true
     script.Parent.Visible = false
end)

This should work, if it does, then please accept this answer.

0
local script or regular? 22To 70 — 9y
0
Whichever one you used awfulszn 394 — 9y
Log in to vote
0
Answered by 9 years ago
local sp = script.Parent
local holder = script.Parent.Parent:WaitForChild("Holder")

function die()

Holder.Visible = true



    sp.Visible = false 

end

script.Parent.MouseButton1Down:connect(die)

Answer this question