function onTouched(hit)
local touched = false
if not touched then
touched = true
local check = hit.Parent:FindFirstChild("Humanoid")
if check ~= nil then
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
local stats = user:findFirstChild("Area")
local sound = user.PlayerGui:FindFirstChild("Lobby")
local soundtwo = user.PlayerGui:FindFirstChild("Hi") or user.PlayerGui:WaitForChild("Hi")
local soundthree = user.PlayerGui:FindFirstChild("JC") or user.PlayerGui:WaitForChild("JC")
if stats ~= nil then
stats.Value = "Lobby"
sound:Play()
soundtwo:Stop()
soundthree:Stop()
wait(1)
if stats.Value == 'Lobby' then
soundtwo:Stop()
soundthree:Stop()
end
end
end
touched = false
end
end
script.Parent.Touched:connect(onTouched)
I've made an area music script, which would change area music depending on the value. The script above is what changes the value and the music, however Once the player is still touches the part, the same music will replay. Any way to fix this?

2 comments
Checking if the area value is "Lobby" it would play
also the sound will not change, the area value as well.