Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make my script stop the correct sound?

Asked by 5 years ago

I created a script where when you click, it opens a menu with the songs you can play, and when you click a song it plays it and an animation, and when you click stop it should stop the song and animation. When I run a test server with two players, I have them both play a song. Sometimes when I click stop on one player it will stop the other players song or not stop the song at all. Does anyone know why this is happening?

SERVER SCRIPT:

01unequipt = game.ReplicatedStorage.Unequpit
02stopsong = game.ReplicatedStorage.StopSong                   -------events
03choosesong = game.ReplicatedStorage.ChooseSong
04songstopped = game.ReplicatedStorage.songstopped
05 
06game.Players.PlayerAdded:Connect(function(player)
07    player.CharacterAdded:Connect(function(character)
08        if player.TeamColor == BrickColor.new("Really red") then
09            f = game.ReplicatedStorage["British Fife"]
10            f:Clone().Parent = player.Backpack
11            player.PlayerGui:WaitForChild("ScreenGui").Frame.TextButton1.Text = "The British Grenadiers"             ----------sets guis
12            player.PlayerGui:WaitForChild("ScreenGui").Frame.TextButton2.Text = "The Girl I Left Behind Me"
13            player.PlayerGui:WaitForChild("ScreenGui").Frame.TextButton3.Text = "Lilliburlero"
14            player.PlayerGui:WaitForChild("ScreenGui").Frame.TextButton4.Text = "Rule Britannia"
15        end
View all 69 lines...

LOCAL SCRIPT:

01unequipt = game.ReplicatedStorage.Unequpit --remoteevent
02stopsong = game.ReplicatedStorage.StopSong --remoteevent
03choosesong = game.ReplicatedStorage.ChooseSong --remoteevent
04songstopped = game.ReplicatedStorage.songstopped --remoteevent
05 
06player = game.Players.LocalPlayer
07 
08 
09script.Parent.Equipped:Connect(function(mouse) --equipted
10    mouse.Button1Down:Connect(function()
11        if player.Character:FindFirstChild("British Fife") then
12            if not player.PlayerGui:WaitForChild("ScreenGui").Stop.Visible and not player.PlayerGui:WaitForChild("ScreenGui").Frame.Visible then
13                player.PlayerGui.ScreenGui.Frame.Visible = true
14            end
15        end
View all 67 lines...

Answer this question