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)

1 comment
The problem was that it was a Localscript. I fixed it a while ago but thank you for your knowledgeable insight.