So I made a script and it works to a certain level basically meaning it just plays the music but i want it so that when the door part (basically a part) is touched the first time it will play the sound for just that player and when the go through the door again it stops playing the music.
Below is the script
local sound = Instance.new("Sound", workspace)
sound.Pitch = 1 -- Speed of the song (Preffer not to change it)
sound.SoundId = "rbxassetid://4772956740" -- Put the last numerbs of the link of the song(ROBLOX) that you want
sound.Volume = .5 -- Volume(How much power) of the song
sound.Looped = true -- If you want the song to repeat after the song is done
local part = script.Parent
local number = 0
local function onPartTouched(otherPart)
local partParent = otherPart.Parent
local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
if humanoid and number == 0 then
sound:Play()
number = number + 1
end
end
if number == 2 then
sound:stop()
number = 0
end
part.Touched:Connect(onPartTouched)

1 comment
also this has to be attached to the part