#why ts being a one hit wonder
1 messages · Page 1 of 1 (latest)
replace "true" with "not player.PlayerGui.SiopaGui.Enabled"
you basically did the same thing as wiring a light switch to only turn on and never off
I have a script that sets enabled to false though
by one hit wonder do you mean you turn on and then off but it doesnt turn on a second time?
yeah
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
thats weird
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
** You are now Level 6! **
you could try combining the two scripts and seeing what happens then
This is true, I would recommend that you make it one big script where you can use a boolean to keep track of it's status
is ts an insult
Well usually that is how you would do that
Make a simple if statement to handle boolean status
you mean do this?
idk if you mean the big script or the if statement thingy cuz I dont see why you would use it here
Or use a bindable event
if you mean as in
local prompt = script.Parent
local enabled = player.PlayerGui.SiopaGui.Enabled
prompt.Triggered:Connect(function(player)
if enabled then
enabled = false
else
enabled = true
end
end)```
it works the same as the new version
That's because of how variables work
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
then how would you do it
Make a variable for the gui
Then just use the .enabled property
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
That's one way of doing it sure
oooor you can just do
local prompt = script.Parent
prompt.Triggered:Connect(function(player)
player.PlayerGui.SiopaGui.Enabled = not player.PlayerGui.SiopaGui.Enabled
end)
I did it as that already
the problem isn't that it doesn't work
I mean
it only half works
make sure there's no other scripts interfiring with the gui then?
Even with the new one u did?
yes
wait
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Enabled = false
end)```
I have another script for closing the gui
delete it
No, they can still use it
originally it was just this
local prompt = script.Parent
prompt.Triggered:Connect(function(player)
player.PlayerGui.SiopaGui.Enabled = true
end)```
bruh
It just needs to be the same type of script
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Enabled = false
end)``` with this also
what's the point of having 2 different scripts that do the same thing...
the original one only enabled it
but I got told to use "not"
What ru trying to do here?
wait I'll show a demonstration
Some games have multiple ways of doing one thing🤷♂️
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
Combine both scripts into 1 local script that handles the proxmity prompt and the gui button
how would I do that?
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
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
probably because you're opening the menu on the server and closing it on the client, so the next time the server tries to open the menu it thinks its already open so nothing happens, it doesn't know the client closed it. to fix this you need to open and close on the same side of the client/server boundary, i.e remote events
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?
I thought I did tell him to put everything in a local script tho...
yes but you also did not correctly identify the problem, took you a bit to get there. putting everything in one script looks like a guess ;p
its okay tho, this comes up a lot for beginners and now you know to keep an eye out for it 