My script applies to all players, even though it's a local script

My script is a local script that changes the music when you touch a certain block. I have stored them in StarterPlayerScripts, and I had a friend join me and he had touched the block. It had changd the music for me as well, and I didn’t touch the object. How could I fix this?

local debounce

game.workspace.MusicChanger.Touched:Connect(function(hit)
local character = hit:FindFirstAncestorOfClass(“Model”)
if character then
local humanoid = character:FindFirstChild(“Humanoid”)
if not humanoid then
return
end

    debounce = true

    workspace.Music.SoundId = "rbxassetid://4786356457"
    print("Checkpoint")
    wait(5) -- change cooldown

    debounce = false
end

end)

Script was made by @Operatik

1 Like

You can change this on

game:GetService("SoundService").RespectFilteringEnabled = true
1 Like

Where in the code should this be placed? At the top?

Noon, it’s just a service, you can just call it form a script.
On serverscriptservice just do that

Alright, thanks. I’ll see if it works.

Edit: Yup, it works. Thanks for the help!

Mark as solution ;-;- 30chars :safety_pin: