Hello! I have 2 almost identical scripts, but one of them work incorrectly. The meaning of scripts: when you step on a part, the local player plays a sound. Problem: the first script works correctly, but the second does not, he just plays for all the players
Script:
1-st
local function BlackScreen(otherPart) local player = game.Players:FindFirstChild(otherPart.Parent.Name) if player then player.Character.Humanoid.WalkSpeed = 0 player.Character.Humanoid.JumpPower = 0 player.PlayerGui.ScreenGui.Black.BackgroundTransparency = 0 game.SoundService.Sound:Stop() game.SoundService.Sound1:Play() wait(2.6) game.SoundService.Sound2:Play() wait(1) game.SoundService.Sound:Play() player.PlayerGui.ScreenGui.Black.BackgroundTransparency = 1 player.Character.Humanoid.WalkSpeed = 16 player.Character.Humanoid.JumpPower = 50 end end
2-nd
local function BlackScreen2(otherPart) local player = game.Players:FindFirstChild(otherPart.Parent.Name) if player then game.SoundService.Sound:Stop() wait(6) game.SoundService.Sound3:Play() wait(3.720) game.SoundService.Sound:Play() end end
Okay, I fixed it. I just added these lines to the second code:
player.Character.Humanoid.WalkSpeed = 16 player.Character.Humanoid.JumpPower = 50 player.PlayerGui.ScreenGui.Black.BackgroundTransparency = 1
I didn't understand what the bug was, but I hope it helps someone :/