Here is my localscript code; inside the startergui:
local RemoteEvent = game.Workspace:WaitForChild("Music"):WaitForChild("RemoteEvent")
local player = game.Players.LocalPlayer
canplay = true
RemoteEvent.OnClientEvent:Connect(function()
if canplay then
local sound = player.PlayerGui:WaitForChild("sound")
sound:Play()
sound.Looped = true
print(otherpart)
canplay = false
end
end)
Here is my script code inside the workspace:
local part = game.Workspace.Music
local RemoteEvent = Instance.new("RemoteEvent", part)
local sound = game.Workspace["Final Boss"]
canplay = true
local function muziekspelen(otherpart)
print(otherpart)
local humanoid = otherpart.Parent:FindFirstChild("Humanoid")
if humanoid and canplay then
local player = game.Players:GetPlayerFromCharacter(otherpart.Parent)
canplay = false
RemoteEvent:FireClient(player)
sound.Parent = player.PlayerGui
sound:Play()
sound.Looped = true
end
canplay = true
end
part.Touched:connect(muziekspelen)
I don't want to repeat the sound everytime it's being touched by the localplayer. Does anyone know how to do this?

2 comments
Please clarify your question. What is your code supposed to do? ...Cdfdfsdfdfsdfdf??
If a certain block called music get's touced it needs to play a sound that can only be heared by the localplayer i got that working but if u keep walking on the block the sound will just replay