I have this code, what it does it when a player gets 2 or more kills, a killing spree sound plays and gui pops up on the screen for all players in the server (except grey team).
The problem: The sound and gui only work for the local player (ie, the person who got the kills)
Here's the code. Like I said, not sytax errors. There is an underlying algorithm error somewhere and I need help.
Blue is one team, Red is another team
repeat wait(2) until game.Players.LocalPlayer.Character~=nil wait(.5) kid = game.Players.LocalPlayer kid.Changed:connect(function(change) wait(.1) if (change == "TeamColor") then if workspace.Blue:FindFirstChild(game.Players.LocalPlayer.Name) then workspace.Blue[game.Players.LocalPlayer.Name].Kills.Changed:connect(function() for i,v in pairs(game.Players:GetChildren()) do --//Blue//-- if (game.Players:FindFirstChild(v.Name) ~= nil) then if (game.Players[v.Name].Character ~= nil) then if not (game.Players[v.Name].TeamColor == BrickColor.new("Mid gray")) then --if the menu is open, add condition to return end this later if (workspace.Blue[game.Players.LocalPlayer.Name].Kills.Value >= 2) then if game.Players[v.Name]:FindFirstChild(PlayerGui) then game.Players[v.Name].PlayerGui.GameGui.KillSpree.PlayerPic.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&userid=" ..game.Players.LocalPlayer.userId if (workspace.Blue[game.Players.LocalPlayer.Name].Kills.Value == 2) then game.Players[v.Name].PlayerGui.GameGui.KillSpree.PlayerPic.Info.Text = game.Players.LocalPlayer.Name.." is on a DOUBLE KILL with 2 Kills!" game.Players[v.Name].PlayerGui.LocalPlayerScripts.DoubleKill:Play() elseif (workspace.Blue[game.Players.LocalPlayer.Name].Kills.Value == 3) then game.Players[v.Name].PlayerGui.GameGui.KillSpree.PlayerPic.Info.Text = game.Players.LocalPlayer.Name.." is on a TRIPLE KILL with 3 Kills!" game.Players[v.Name].PlayerGui.LocalPlayerScripts.TripleKill:Play() elseif (workspace.Blue[game.Players.LocalPlayer.Name].Kills.Value == 4) then game.Players[v.Name].PlayerGui.GameGui.KillSpree.PlayerPic.Info.Text = game.Players.LocalPlayer.Name.." is on a ULTRA KILL with 4 Kills!" game.Players[v.Name].PlayerGui.LocalPlayerScripts.UltraKill:Play() elseif (workspace.Blue[game.Players.LocalPlayer.Name].Kills.Value == 5) then game.Players[v.Name].PlayerGui.GameGui.KillSpree.PlayerPic.Info.Text = game.Players.LocalPlayer.Name.." is on a MEGA KILL with 5 Kills!" game.Players[v.Name].PlayerGui.LocalPlayerScripts.MegaKill:Play() elseif (workspace.Blue[game.Players.LocalPlayer.Name].Kills.Value > 5) then game.Players[v.Name].PlayerGui.GameGui.KillSpree.PlayerPic.Info.Text = game.Players.LocalPlayer.Name.." is on a RAMPAGE with "..workspace.Blue[game.Players.LocalPlayer.Name].Kills.Value.." Kills!" game.Players[v.Name].PlayerGui.LocalPlayerScripts.Rampage:Play() end game.Players[v.Name].PlayerGui.GameGui.KillSpree.PlayerPic:TweenPosition(UDim2.new(0, 10, 0, 0), "Out", "Back", 1.5, true) wait(5.5) if game.Players:FindFirstChild(v.Name) then game.Players[v.Name].PlayerGui.GameGui.KillSpree.PlayerPic:TweenPosition(UDim2.new(-20, 10, 0, 0), "Out", "Quart", 4, false) end end end end end end end end) end elseif workspace.Red:FindFirstChild(game.Players.LocalPlayer.Name) then print'do nothing' else end end)
The problem is that you try to do that from local script. You should definetely make a server script, that makes the GUI pop up for everyone. Now, when you need to show that GUI and play sound, fire a RemoteEvent, that you hook up with your script, and pass it the player who got the spree. You could also pass what kind of spree it was, so you could handle all streaks with one script.
If you don't know how to use RemoteEvent, then here is a little demo:
LocalScript:
game.ReplicatedStorage.RemoteEvent:FireServer("Player1", "killstreak:2")
Script:
game.ReplicatedStorage.RemoteEvent.OnServerEvent:connect(function(playerName, data) --(..) end)