Used Local script only
local sound = Instance.new("Sound", game.Workspace) sound.SoundId = "rbxassetid://2830837614" sound.Looped = true sound:Play() sound.Playing = true local bool = script.Parent.Changer bool.Value = true if bool.Value == true then script.Parent.Activated:Connect(function() bool.Value = false sound.Playing = false end) end if bool.Value == false then script.Parent.Activated:Connect(function() bool.Value = true sound.Playing = true end) end
Try this
local sound = Instance.new("Sound", game.Workspace) sound.SoundId = "rbxassetid://2830837614" sound.Looped = true sound:Play() sound.Playing = true local bool = script.Parent.Changer bool.Value = true if bool.Value == false then script.Parent.Activated:Connect(function() bool.Value = false sound.Playing = false end) end if bool.Value == true then script.Parent.Activated:Connect(function() bool.Value = true sound.Playing = true end) end
In your script, since you set the bool as true, the script will run and wait for it to activate until it can set it to false. The script only runs once, and that is your problem;;;;;; i think you can just use the activated event, and then check if the bool is true to change it, so that the script runs multiple times when needed
local sound = Instance.new("Sound", game.Workspace) sound.SoundId = "rbxassetid://2830837614" sound.Looped = true sound:Play() sound.Playing = true local bool = script.Parent.Changer bool.Value = true script.Parent.Activated:Connect(function() -- activated? if bool.Value == true then -- if its true bool.Value = false -- change to false sound.Playing = false else -- if its false bool.Value = true sound.Playing = true end end)