zoolbia
(mvunkie)
April 16, 2021, 4:27pm
#1
So I made a script for a button that disappears when you press it but it doesn’t disappear
This is the code:
local PlayButton = script.Parent.PlayButton
PlayButton.MouseButtonClick:Connect(function()
PlayButton.Visible = false
end)
Can somebody help me fix this problem?
MouseButton1Click
not MouseButtonClick
. IF that doesn’t work, a few extra questions
Is PlayButton
a TextButton
or an ImageButton
? If not, then they must be for MouseButton1Click
to work
Script must be a Localscript, not a regular script
1 Like
If this is a server script, the changes won’t be replicated to the client
zoolbia
(mvunkie)
April 16, 2021, 4:34pm
#4
Oooooh no I just forgot the 1 in the article but thanks I forgot to put the script in localscript
1 Like
zoolbia
(mvunkie)
April 16, 2021, 4:36pm
#5
Well it’s an imagebutton I did put it in a local script this time but it still doesn’t work
Any errors? May I see both the code and where the imagebutton is located in the explorer?
What’s your code right now? I think your issue, if the script is in the PlayButton, is that you’re doing script.Parent.PlayButton
instead of script.Parent
1 Like
zoolbia
(mvunkie)
April 16, 2021, 4:39pm
#10
I know it’s just a mistake in the article
Ah okay then I didn’t see that my mistake.
zoolbia
(mvunkie)
April 16, 2021, 4:40pm
#12
Thanks it worked! 30 (characters)
1 Like
Anytime! If you have anymore issues don’t be afraid to make another post!
Is it a local script? It usually doesn’t work if it is a local script.
iShouldG0
(iShouldG0)
April 16, 2021, 5:29pm
#15
Tip: I see you have multiple scripts for each button. You could put everything in one script.
-- Example Script
local Button1 = script.Parent.Button1
local Button2 = script.Parent.Button2
Button1.MouseButton1Click:Connect(function()
print("Button 1 Clicked")
end)
Button2.MouseButton1Click:Connect(function()
print("Button 2 Clicked")
game.Players.LocalPlayer.Character.Humanoid.Health = 100 -- Heal the player
end)
1 Like