I can’t make the sound camsound play when the GUI button is clicked.
script.Parent.MouseButton1Click:Connect(function()
local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local b2 = workspace.camsys.b2
local light2b = b2.PointLight
local static = player.PlayerGui.static
local Map = script.Parent.Parent.Parent["First Part"]
static.Enabled = true
cam.CameraSubject = b2
cam.CameraType = "Attach"
wait(0.2)
cam.CameraType = "Fixed"
light2b.Enabled = true
local camsound = script.Parent.Parent.Parent.Chnage
local camamb = script.Parent.Parent.Parent.Camamb
camsound:Play()
camamb:Play()
end)
Nerbzzz
(Nikki)
March 3, 2022, 12:59pm
#2
Does the sound have a valid id, Correct volume, Is it named “Chnage”?
If so, Is script.parent either a textbutton or imagebutton?
1 Like
Yes, the sound is working and has nothing to do with it.
Here’s a screenshot of the file system:
Nerbzzz
(Nikki)
March 3, 2022, 1:12pm
#4
Is the button a TextButton and not a TextBox? (They have the same icon)
The button is an invisible text button with nothing written on it.
EVALDOL
(catstealer83)
March 3, 2022, 1:52pm
#6
Can you play it from roblox studio?
If you mean the song then yes. I can play the song in Studio in the properties tab but not with the script
EVALDOL
(catstealer83)
March 3, 2022, 1:53pm
#8
That “Chnage” sound you are trying to play
EVALDOL
(catstealer83)
March 3, 2022, 1:57pm
#9
This script works fine for me.
The sound is used in another script as well that is triggered before the script in question. Maybe that is making it not work?
EVALDOL
(catstealer83)
March 3, 2022, 2:01pm
#11
What does this script do to the sound?
It just plays it. + I think I found the issue. When the first script plays the sound the Property playing is true states on and can’t be triggered anymore so I will not play in the second script.
First off, if you aren’t already, you need to parent the UI to the PlayerGui. Second, if this is a normal script, you need to change LocalPlayer to a different method, because it can’t run in a normal script.
Those are the only reasons it shouldn’t be working,
No, I got it working so no problem. I just added this camsound.Playing = false before the camsound:Play()