So I got help from here to make this local script. It is under PlayerGui however, when the player is in first person camera view while touching the brick, the audio literally breaks. Why?

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local part = game.Workspace.Stores.GeneralStore.GeneralStoreMusic

part.Touched:Connect(function(hit)
    if hit.Parent == player.Character  then
        player.PlayerGui.Music.GeneralStoreMusic:Play()
    end
end)

part.TouchEnded:Connect(function(hit)
    if hit.Parent == player.Character then
        player.PlayerGui.Music.GeneralStoreMusic.Playing = false
    end
end)

6 comments

0

Line 13 change GeneralStoreMusic:Stop() ?

0

You want it so when the player touches the part, the music plays and when the player stops touching the part, the music will stop?

0

The script works, however when the player is in first person camera view, the audio doesn't play...

0

It's probably a bug, try printing when the touchended event fires: print('touch ended'), and see that if you zoom in, it prints

0

tell me if it does or not

0

It does print when the touch is ended whenever the camera moves around in first person view.