#why ts being a one hit wonder

1 messages · Page 1 of 1 (latest)

coral sapphire
#
local prompt = script.Parent

prompt.Triggered:Connect(function(player)
    player.PlayerGui.SiopaGui.Enabled = true
end)```
it only works once
marble trout
#

you basically did the same thing as wiring a light switch to only turn on and never off

coral sapphire
marble trout
#

by one hit wonder do you mean you turn on and then off but it doesnt turn on a second time?

marble trout
#

whats the other script look like

#

the one that turns it off

coral sapphire
#

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Enabled = false
end)

#

btw the thing that you told me to do half fixed it it works more than once but you have to hold e twice to enable it

marble trout
#

thats weird

coral sapphire
#

I think it might be because the script doesn't know its been disabled or something your method is the most functioning way so far so I'm gonna keep it like that for now thanks

azure trellisBOT
#

studio** You are now Level 6! **studio

marble trout
#

you could try combining the two scripts and seeing what happens then

zenith harness
zenith harness
#

Make a simple if statement to handle boolean status

coral sapphire
#

idk if you mean the big script or the if statement thingy cuz I dont see why you would use it here

zenith harness
#

An if statement?

#

Just "if enabled then do code, else do other code"

coral sapphire
zenith harness
#

When you do enabled = true you aren't referencing the desired instance

#

You are referencing and redefining a variable

#

Instead just do yourgui.enabled = true/false

#

Because that directly references your desired instance

#

Basically the reason why it won't work is because you change the variable into a boolean

#

Instead you need to be changing the status of a property

coral sapphire
#

then how would you do it

zenith harness
#

Make a variable for the gui

zenith harness
coral sapphire
#
local prompt = script.Parent

prompt.Triggered:Connect(function(player)
    if player.PlayerGui.SiopaGui.Enabled then
        player.PlayerGui.SiopaGui.Enabled = false
    else
        player.PlayerGui.SiopaGui.Enabled = true
    end
end)```
#

is that what youre saying

zenith harness
#

That's one way of doing it sure

ivory quiver
#

oooor you can just do

local prompt = script.Parent

prompt.Triggered:Connect(function(player)
   player.PlayerGui.SiopaGui.Enabled = not player.PlayerGui.SiopaGui.Enabled
end)
coral sapphire
#

I did it as that already

#

the problem isn't that it doesn't work

#

I mean

#

it only half works

ivory quiver
#

make sure there's no other scripts interfiring with the gui then?

zenith harness
coral sapphire
#

wait

#
script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Enabled = false
end)```
I have another script for closing the gui
zenith harness
coral sapphire
#

originally it was just this

local prompt = script.Parent

prompt.Triggered:Connect(function(player)
    player.PlayerGui.SiopaGui.Enabled = true
end)```
ivory quiver
#

bruh

zenith harness
coral sapphire
#
script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Enabled = false
end)``` with this also
ivory quiver
#

what's the point of having 2 different scripts that do the same thing...

coral sapphire
#

but I got told to use "not"

zenith harness
coral sapphire
#

wait I'll show a demonstration

zenith harness
coral sapphire
#

nvm I'll just explain it fully

#

So I'm trying to make it so when you hold e on the prompt the gui appears and when you click the x on the gui it disappears but after you make it disappear when you try opening the gui it wouldn't open again

I got told to changed the script to make it so you can also disabled it if you hold e while its open but if you press x and try reopening it you would have to hold e twice thats the problem I'm trying to solve

ivory quiver
coral sapphire
#

how would I do that?

ivory quiver
#

uh

#

just put both scripts that you have in 1 script?

coral sapphire
#

nvm I didn't think it would be that easy

#

anyways thanks

#

actually nvm

#

its still doing that thing where you have to hold the prompt twice

marble trout
#

Maybe a screen shot of the explorer would help

#

With the relevant things expanded

#

So whatever screen gui you got with all the children shown

earnest karma
#

or with a proximityprompt just connect to it on the client since you're already dealing with the menu on the client

#

the detour through server not useful?

ivory quiver
earnest karma
#

its okay tho, this comes up a lot for beginners and now you know to keep an eye out for it Thumbs