game.Players.LocalPlayer.Chatted:connect(function(Chatted)
if game.Players.LocalPlayer.PlayerGui:FindFirstChild("sound1233442") then
game.Players.LocalPlayer.PlayerGui.sound1233442:Destroy()
end
if tonumber(Chatted) then
local sound = Instance.new("Sound", game.Players.LocalPlayer.PlayerGui)
sound.Name = "sound1233442"
sound.SoundId = "rbxassetid://"..Chatted:sub(1,string.len(Chatted))
sound:Play()
end
if Chatted == "loop = on" then
script.Value = true
elseif Chatted == "loop = off" then
script.Value = false
end
if tonumber(Chatted) and script.Value == true then
local loopsound = Instance.new("Sound", game.Players.LocalPlayer.PlayerGui)
loopsound.Name = "sound1233442"
loopsound.SoundId = "rbxassetid://"..Chatted:sub(1,string.len(Chatted))
game.Players.LocalPlayer.PlayerGui:FindFirstChild("sound1233442").Looped = true
loopsound:Play()
end
end)
The problem is that the audio isn't looped. What is the problem in there? What I want here is that after a player says "loop = on" whatever the music id they say next will be looped, unless they type "loop = off". Here's the error log after I say "loop = on". Same for "loop = off":
Value is not a valid member of LocalScript
23:46:43.501 - Script 'Players.Player.PlayerScripts.Music/song_script', Line 16
23:46:43.502 - Stack End
Also, there is a boolValue inside the Music/song_script, so I have no idea why it's telling me it's not a valid member.
This siggy is copyrighted ©
|