I am trying to play music in specific areas by placing a block that is invisible and players cannot collide with it, so when the players "hit" that block, then music will start playing. I placed a script within the part for the music, but the problem is that in Roblox Studio, the music will play, but as I test it in game, the music does not play at all. Any idea on how to fix this?
script.Parent.Touched:connect(function(hit)
if hit.Parent:WaitForChild('Humanoid') then
local player = game:GetService('Players'):GetPlayerFromCharacter(hit.Parent)
local playergui = player:WaitForChild('PlayerGui')
local sound3 = playergui:WaitForChild('Sound3')
sound3.Volume = 1
sound3:Play()
end
end)
script.Parent.TouchEnded:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid')then
game.Players[hit.Parent.Name].PlayerGui.Sound3.Volume = 0
end
end)

2 comments
Is your game filtering enabled?
No