Hello,
So I have this teleportation thing in my game to where when you step on Pad1 (for example) you get teleported to Pad2. The thing is that I’m trying to make a sound from Workspace play locally whenever you teleport but atm it’s playing for everyone. I’ve looked up threads on how to make sounds play locally but they weren’t very helpful for my situation as I got 2 different scripts going on for this. Here’s how they’re set up:
The TP script in Workspace:
The code:
local Pad2 = game.Workspace.Pad2
script.Parent.Touched:Connect(function(touchPart)
if touchPart and touchPart.Parent and touchPart.Parent.Humanoid and touchPart.Parent.currentlyTeleporting.Value == false then
local Character = touchPart.Parent
local teleportLocation = CFrame.new(Pad2.CFrame.X, Pad2.CFrame.Y + 5, Pad2.CFrame.Z)
Character:SetPrimaryPartCFrame(teleportLocation)
game.Workspace.loading:Play()
local teleportingValue = Character.currentlyTeleporting
teleportingValue.Value = true
wait(3)
teleportingValue.Value = false
end
end)
and the supposed LocalScript to play sounds locally:
The code:
local Pad1 = workspace.Pad1
local jumpscare = game.Workspace.jumpscare
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local DB = false
Pad1.Touched:Connect(function(Hit)
if not DB and Character == Hit.Parent then
DB = true
jumpscare:Play()
DB = false
end
end)
Clip of everything in action:
I got my alt to join the game with me to test if it really played locally now but for some reason, it still plays for everyone. I know that there’s a way to properly set this up and get it to work but since I’m not very experienced in scripting, I’m struggling a bit to figure this issue out. I’d appreciate anyone who could be kind enough to explain me through this annoying issue!