I've been trying to make a script for my game that makes a Sound/Music play when a frame is visible and it will stop when it's Invisible, I have attempted to make the script on my own but since I'm a beginner I don't know how...
I've put the script below (excuse the clutter.) Any help would be appreciated. :)
--Script--
local Mapvote = script.Parent.Parent
local music = script.Parent
local musicPlaying = false
local audioID = 4814920271
local sound = Instance.new("Sound", music)
sound.SoundId = 'rbxassetid://'..audioID
if Mapvote.Visible == true then
if(musicPlaying == false) then
sound:Play()
musicPlaying = true
else
sound:Stop()
musicPlaying = false
end
end

2 comments
It works, kind of. The script plays a fraction of sound not the whole song.
EEK