Nacidi
(ahren)
May 20, 2020, 12:26pm
#1
Hello, everyone!
While scripting a button that would stop a sound and make and make an image invisible, the button wouldn’t work, anyone can help me?
here are the script and explorer:
edit: I am using the reset ventilation
script.Parent.MouseButton1Click:Connect(function()
game.StarterGui.ScreenGui1.Frame.sound2:Stop()
game.Players.LocalPlayer.PlayerGui.Cameras.Frame.Visible = true
end)
https://gyazo.com/96613accbceb8c92bccd08557a8a940c
1 Like
cory
(cory)
May 20, 2020, 12:32pm
#2
Can you try to print after clicking the button?
Sample:
script.Parent.MouseButton1Click:Connect(function()
print("works")
game.StarterGui.ScreenGui1.Frame.sound2:Stop()
game.Players.LocalPlayer.PlayerGui.Cameras.Frame.Visible = true
end)
If the print doesn’t succeed, that means something is wrong with the button. Maybe you forget to enable it. If succeed, that means something is wrong with line 2 or/and 3. Let me know!
EDIT: You said you want to make an image invisible. You are supposed to make the visible false, not true.
Nacidi
(ahren)
May 20, 2020, 12:36pm
#3
sorry about that, I wanted to make it invisible
Nacidi
(ahren)
May 20, 2020, 12:37pm
#4
but no, it doesn’t print anything
cory
(cory)
May 20, 2020, 12:39pm
#5
Are you sure it doesn’t print? It’s possible you forget to enable the button.
1 Like
Esma210
(Esma210)
May 20, 2020, 12:40pm
#6
Make sure it is active as well. Maybe that would help.
2 Likes
Nacidi
(ahren)
May 20, 2020, 12:44pm
#7
it gives me an underline error on the end
Is this a local script or a normal script?
Nacidi
(ahren)
May 20, 2020, 12:46pm
#9
it is a local script, should I use a server script?
cory
(cory)
May 20, 2020, 12:47pm
#10
Uh, it shouldn’t be an error. Can you send the script here again?
1 Like
Nacidi
(ahren)
May 20, 2020, 12:47pm
#11
script.Parent.MouseButton1Click:Connect()
print(“work”)
game.StarterGui.ScreenGui1.Frame.sound2:Stop()
game.Players.LocalPlayer.PlayerGui.Cameras.Frame.Visible = false
end
cory
(cory)
May 20, 2020, 12:48pm
#12
script.Parent.MouseButton1Click:Connect()
print(“work”)
game.StarterGui.ScreenGui1.Frame.sound2:Stop()
game.Players.LocalPlayer.PlayerGui.Cameras.Frame.Visible = false
end)
Add parenthesis to ‘end’.
1 Like
Can you send a photo of your explorer. I need to see the starterGui to help you.
I had the same mistake
Nacidi
(ahren)
May 20, 2020, 12:49pm
#14
script.Parent.MouseButton1Click:Connect(function()
print("works")
script.Parent.Parent.Parent.Parent.ScreenGui1.Frame.sound2:Stop()
game.Players.LocalPlayer.PlayerGui.Cameras.Frame.Visible = true
end)
Try this
cory
(cory)
May 20, 2020, 12:52pm
#16
Ohh! You forgot to add “function”. My apologies!
Nacidi
(ahren)
May 20, 2020, 12:57pm
#17
It’s okay, thanks for the support!
1 Like