I would like OpenSound1 to play locally (currently it is playing globally all over the map). I have been trying to figure this out myself but I just keep breaking it :( Line 37 is when the sound plays. I appreciate the help so much! Thank you in advance!
print("Advanced SpecialDoor Script loaded") permission = { "Fire Dorm" } Door = script.Parent.Parent.PersonDoor DoorMesh = script.Parent.Parent.PersonDoor.Mesh Sensor = script.Parent function checkOkToLetIn(name) for i = 1,#permission do if (string.upper(name) == string.upper(permission[i])) then return true end end return false end function onTouched(hit) print("Sensor Hit") local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil ) then -- print("Human touched door") if (checkOkToLetIn(human.Parent.Name)) then print("Human passed test") Wait(0.001) script.Parent.Parent.Dot1.Transparency = 0 wait(0.4) script.Parent.Parent.Dot2.Transparency = 0 wait(0.4) script.Parent.Parent.Dot3.Transparency = 0 wait(0.4) script.Parent.Parent.Open.Transparency = 0 script.Parent.Parent.Close.Transparency = 1 wait(0.2) script.Parent.Parent.OpenSound1:Play() wait(0.1) script.Parent.Parent.OpenSound2:Play() script.Parent.Parent.HandlePart3.Transparency = 0 script.Parent.Parent.HandlePart4.Transparency = 0 script.Parent.Parent.HandlePart.Transparency = 1 script.Parent.Parent.HandlePart2.Transparency = 1 script.Parent.Parent.Acess.Mesh.Scale = Vector3.new(0.9, 0.5, 1.01) Door.Transparency = 0 wait(0.02) Door.CanCollide = false script.Parent.Parent.Dot1.Transparency = 1 script.Parent.Parent.Dot2.Transparency = 1 script.Parent.Parent.Dot3.Transparency = 1 wait(3) script.Parent.Parent.Open.Transparency = 1 script.Parent.Parent.Close.Transparency = 0 script.Parent.Parent.HandlePart3.Transparency = 1 script.Parent.Parent.HandlePart4.Transparency = 1 script.Parent.Parent.HandlePart.Transparency = 0 script.Parent.Parent.HandlePart2.Transparency = 0 script.Parent.Parent.OpenSound2:Play() wait(0.1) script.Parent.Parent.Acess.Mesh.Scale = Vector3.new(0.01, 0.01, 0.01) Door.CanCollide = true Door.Transparency = 0 end end end connection = Sensor.Touched:connect(onTouched)
There is actually a really simple fix to your problem.
To play a sound locally, you need to have the sound somewhere in the Player (I will be using your script a bit in this.)
print("Advanced SpecialDoor Script loaded") permission = { "Fire Dorm" } Door = script.Parent.Parent.PersonDoor DoorMesh = script.Parent.Parent.PersonDoor.Mesh Sensor = script.Parent function checkOkToLetIn(name) for i = 1,#permission do if (string.upper(name) == string.upper(permission[i])) then return true end end return false end function onTouched(hit) print("Sensor Hit") local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil ) then -- print("Human touched door") plr=game.Players:GetPlayerFromCharacter(hit.Parent) if (checkOkToLetIn(human.Parent.Name)) then print("Human passed test") Wait(0.001) script.Parent.Parent.Dot1.Transparency = 0 wait(0.4) script.Parent.Parent.Dot2.Transparency = 0 wait(0.4) script.Parent.Parent.Dot3.Transparency = 0 wait(0.4) script.Parent.Parent.Open.Transparency = 0 script.Parent.Parent.Close.Transparency = 1 wait(0.2) plr.PlayerGui.OpenSound1:Play() wait(0.1) plr.PlayerGui.OpenSound2:Play() script.Parent.Parent.HandlePart3.Transparency = 0 script.Parent.Parent.HandlePart4.Transparency = 0 script.Parent.Parent.HandlePart.Transparency = 1 script.Parent.Parent.HandlePart2.Transparency = 1 script.Parent.Parent.Acess.Mesh.Scale = Vector3.new(0.9, 0.5, 1.01) Door.Transparency = 0 wait(0.02) Door.CanCollide = false script.Parent.Parent.Dot1.Transparency = 1 script.Parent.Parent.Dot2.Transparency = 1 script.Parent.Parent.Dot3.Transparency = 1 wait(3) script.Parent.Parent.Open.Transparency = 1 script.Parent.Parent.Close.Transparency = 0 script.Parent.Parent.HandlePart3.Transparency = 1 script.Parent.Parent.HandlePart4.Transparency = 1 script.Parent.Parent.HandlePart.Transparency = 0 script.Parent.Parent.HandlePart2.Transparency = 0 plr.PlayerGui.OpenSound2:Play() wait(0.1) script.Parent.Parent.Acess.Mesh.Scale = Vector3.new(0.01, 0.01, 0.01) Door.CanCollide = true Door.Transparency = 0 end end end connection = Sensor.Touched:connect(onTouched)
To make a sound play locally, you put the sound inside a player. For this, we can use PlayerGui. To access PlayerGui, we do this:
game.Players.PlayerAdded:connect(function(p) local sound = game.Soundscape.Sound local clone = sound:Clone() clone.Parent = p.PlayerGui clone.Playing = true end)