Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

how to fix the sound play on the all players?

Asked by 9 days ago

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.Islands: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.Islands:Stop()
        wait(6)
        game.SoundService.Sound3:Play() 
        wait(3.720)
        game.SoundService.Jungle:Play()
    end
end

1 answer

Log in to vote
1
Answered by 9 days ago

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 :/

0
ty Ali_MTR 30 — 9d
Ad

Answer this question