|
| 14 Dec 2016 07:12 PM |
This script is supposed to choose a random player and after killing them it should allow you to choose another player. After clicking the text button and killing the player twice the script stops working. I haven't had any errors. Does anyone know what is wrong with the script? Here it is:
script.Parent.MouseButton1Click:connect(function() local players = game.Players:GetPlayers() if #players > 1 then script.Parent.Text = "Target Found" wait(1) script.Parent.Visible = false script.Parent.Text = "Request Target" repeat target = players[math.random(#players)] until target.Name ~= game.Players.LocalPlayer.Name script.Parent.Parent.targetdisplay.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..target.Name script.Parent.Parent.targetdisplay.TextLabel.Text = target.Name script.Parent.Parent.targetdisplay.Position = UDim2.new(0,-185,1,-295) for i=1,5 do script.Parent.Parent.targetdisplay.Position = script.Parent.Parent.targetdisplay.Position + UDim2.new(0,41,0,0) wait() end target.Character.Humanoid.HealthChanged:connect(function() if target.Character.Humanoid.Health <= 0 then script.Parent.Parent.targetdisplay.Position = UDim2.new(0,20,1,-295) for i=1,5 do script.Parent.Parent.targetdisplay.Position = script.Parent.Parent.targetdisplay.Position - UDim2.new(0,41,0,0) wait() end script.Parent.Visible = true target = nil end end) else script.Parent.Text = "No Target Found" wait(1) script.Parent.Text = "Request Target" end end)
game.Players.PlayerRemoving:connect(function(player) if target ~= nil and player.Name == target.Name then script.Parent.Parent.targetdisplay.Position = UDim2.new(0,20,1,-295) for i=1,5 do script.Parent.Parent.targetdisplay.Position = script.Parent.Parent.targetdisplay.Position - UDim2.new(0,41,0,0) wait() end script.Parent.Visible = true target = nil end end) |
|
|
| Report Abuse |
|
|
| |
|
Talaryn
|
  |
| Joined: 24 Feb 2016 |
| Total Posts: 41 |
|
|
| 14 Dec 2016 07:26 PM |
sorry a script this long without indentation is next to impossible to read
|
|
|
| Report Abuse |
|
|
|
| 14 Dec 2016 07:26 PM |
player = {me,kef,sin,lol,ideksin} PickPlayer = tab[math.random(1, #player)] table.remove(player,PickPlayer)
|
|
|
| Report Abuse |
|
|
|
| 14 Dec 2016 07:28 PM |
script.Parent.MouseButton1Click:connect(function() local players = game.Players:GetPlayers() if #players > 1 then script.Parent.Text = "Target Found" wait(1) script.Parent.Visible = false script.Parent.Text = "Request Target" repeat target = players[math.random(#players)] until target.Name ~= game.Players.LocalPlayer.Name script.Parent.Parent.targetdisplay.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..target.Name script.Parent.Parent.targetdisplay.TextLabel.Text = target.Name script.Parent.Parent.targetdisplay.Position = UDim2.new(0,-185,1,-295) for i=1,5 do # script.Parent.Parent.targetdisplay.Position = script.Parent.Parent.targetdisplay.Position + UDim2.new(0,41,0,0) wait() end target.Character.Humanoid.HealthChanged:connect(function() if target.Character.Humanoid.Health <= 0 then script.Parent.Parent.targetdisplay.Position = UDim2.new(0,20,1,-295) for i=1,5 do # script.Parent.Parent.targetdisplay.Position = script.Parent.Parent.targetdisplay.Position - UDim2.new(0,41,0,0) wait() end script.Parent.Visible = true target = nil end end) else script.Parent.Text = "No Target Found" wait(1) script.Parent.Text = "Request Target" end end)
game.Players.PlayerRemoving:connect(function(player) if target ~= nil and player.Name == target.Name then script.Parent.Parent.targetdisplay.Position = UDim2.new(0,20,1,-295) for i=1,5 do # script.Parent.Parent.targetdisplay.Position = script.Parent.Parent.targetdisplay.Position - UDim2.new(0,41,0,0) wait() end script.Parent.Visible = true target = nil end end) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 14 Dec 2016 08:08 PM |
| player = game.Players:GetPlayers()[math.random(1, #game.Players:GetPlayers())] |
|
|
| Report Abuse |
|
|