What Aggror said. Also, I check if the source exists before trying to play it, just in case.
if window:KeyHit(Key.F) then
self.FLsource = Source:Create()
self.FLsource:SetSound(self.sound.FLsound)
self.FLsource:SetVolume(0.2)
self.FLsource:SetLoopMode(true)
end
if self.torch1:Hidden() then
self.torch1:Show()
--check if source exists
if self.FLsource ~= nil then
--if it's not playing, play it
if self.FLsource:GetState() == Source.Stopped then
self.FLsource:Play()
end
end
else
self.torch1:Hide()
--check if source exists
if self.FLsource ~= nil then
--if it's playing, stop it
if self.FLsource:GetState() == Source.Playing then
self.FLsource:Stop()
end
end
end