AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 12:15 AM |
Why doesn't this destroy the Bright red folder in rep storage or destroy the team in teams folder?
game.Players.PlayerRemoving:connect(function(player) for i, team in pairs(game.Teams:GetChildren()) do if player.TeamColor == "Bright red" and game.ReplicatedStorage.NetworkKingdoms.Kingdoms:FindFirstChild("Bright red"):FindFirstChild("NumberOfPlayers").Value > 1 then local Team = game.ReplicatedStorage.NetworkKingdoms.Kingdoms:FindFirstChild("Bright red") local PlayerNames = Team.PlayerNames:GetChildren() if Team:FindFirstChild("NumberOfPlayers").Value > 1 then Team.NumberOfPlayers.Value = Team.NumberOfPlayers.Value - 1 Team.Owner.Value = math.random(1, #PlayerNames).Name end elseif player.TeamColor == "Bright red" and game.ReplicatedStorage.NetworkKingdoms.Kingdoms:FindFirstChild("Bright red"):FindFirstChild("NumberOfPlayers").Value == 1 then game.ReplicatedStorage.NetworkKingdoms.Kingdoms:FindFirstChild("Bright red"):Destroy() game.Teams:FindFirstChild(team):Destroy() end end end)
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Mar 2016 12:28 AM |
I reformatted your code.
local red = game.ReplicatedStorage.NetworkKingdoms.Kingdoms["Bright red"] local num = red.NumberOfPlayers
game.Players.PlayerRemoving:connect(function(player) for i,t in next, game.Teams:GetChildren() do if player.TeamColor == BrickColor.new("Bright red") then if num.Value > 1 then local names = red.PlayerNames:GetChildren() if num.Value > 1 then num.Value = num.Value - 1 red.Owner.Value = math.random(1, #names).Name end elseif num.Value == 1 then red:Destroy() game.Teams[t]:Destroy() end end end end)
|
|
|
| Report Abuse |
|
|
AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 12:31 AM |
@TimeTicks, Didn't work.
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Mar 2016 12:35 AM |
Well debug your code. You have two if statements. Is the players teamcolor Bright Red? Is the NumberOfPlayers = 1? Then destroy the kingdom and destroy the team. Look at your output too.
|
|
|
| Report Abuse |
|
|
AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 12:39 AM |
This is the error I get..
00:38:13.992 - An error occurred 00:38:13.993 - Script 'http://www.roblox.com/game/gameserver.ashx', Line 118 00:38:13.994 - Stack End
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Mar 2016 12:40 AM |
Lol i dont even think thats part of your game. Anyways, if that is your script go to that line. Also put prints everywhere to check how far the code gets
|
|
|
| Report Abuse |
|
|
AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 12:42 AM |
I do have prints but they dont print. But when a player leaves, that's the error I get. I know I have the players TeamColor right because I set it to that color in another script by player.TeamColor = BrickColor.new("Bright red") and I know it's 1 because it sets it to one in a different script by game.ReplicatedStorage.NetworkKingdoms.Kingdoms:FindFirstChild("Bright red").NumberOfPlayers.Value = 1
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Mar 2016 12:47 AM |
Well post the code with the prints and the output of the prints. The gameserver error is irrelevant.
|
|
|
| Report Abuse |
|
|
AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 12:50 AM |
No output..
local red = game.ReplicatedStorage.NetworkKingdoms.Kingdoms["Bright red"] local num = red.NumberOfPlayers
game.Players.PlayerRemoving:connect(function(player) for i,t in next, game.Teams:GetChildren() do if player.TeamColor == BrickColor.new("Bright red") then print("Team color is red") if num.Value > 1 then print("NumOfPlayers is greater than 1") local names = red.PlayerNames:GetChildren() if num.Value > 1 then print("NumOfPlayers is greater than 1") num.Value = num.Value - 1 red.Owner.Value = math.random(1, #names).Name end elseif num.Value == 1 then print("NumOfPlayers is 1") red:Destroy() game.Teams[t]:Destroy() end end end end)
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Mar 2016 12:53 AM |
if print("Team color is red") wont event print then the players teamcolor is not bright red ...double check to see that the players teamcolor is bright red
|
|
|
| Report Abuse |
|
|
AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 12:57 AM |
I am 100% positive it changes to Bright red, I have tested it in solo play AND starting a server from studio and starting a player, both times it changes it.
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Mar 2016 01:06 AM |
okay. Then before
if player.TeamColor
do this:
print(player.TeamColor)
Also, if the teams is empty, the for loop won't do anything (because there is nothing in teams)
|
|
|
| Report Abuse |
|
|
AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 01:08 AM |
It didn't print anything...But gave me that stupid error again.
And there is a team in teams called Deciding.
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Mar 2016 01:12 AM |
okay try this:
local red = game.ReplicatedStorage.NetworkKingdoms.Kingdoms["Bright red"] local num = red.NumberOfPlayers
game.Players.PlayerRemoving:connect(function(player) if player.TeamColor == BrickColor.new("Bright red") then if num.Value > 1 then local names = red.PlayerNames:GetChildren() if num.Value > 1 then num.Value = num.Value - 1 red.Owner.Value = math.random(1, #names).Name end elseif num.Value == 1 then red:Destroy() for i,t in next, game.Teams:GetChildren() do if t.TeamColor == player.TeamColor then t:Destroy() end end end end end)
|
|
|
| Report Abuse |
|
|
AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 01:15 AM |
Nope..
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Mar 2016 01:16 AM |
try the prints again including print(player.TeamColor) right after the playerremoving function
|
|
|
| Report Abuse |
|
|
AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 01:19 AM |
Nope, no prints.
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Mar 2016 01:21 AM |
Is it a serverscript?
Also, the reason it may not print is because the players is leaving... I have no other idea at this point.
|
|
|
| Report Abuse |
|
|
AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 01:22 AM |
Yes server script inside ServerScriptService
But playerremoving has a player argument for a reason. I don't understand why I can't use it then..
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Mar 2016 01:24 AM |
okay...Make sure the script isnt disabled either lol. Then test if the function is even working
game.Players.PlayerRemoving:connect(function(player) print(player.Name) end)
|
|
|
| Report Abuse |
|
|
AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 01:26 AM |
Function doesn't even work, still gives me that other error though when a player leaves..
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 13 Mar 2016 01:27 AM |
Have any while loops anywhere in the script?
If all else fails,
Test the scripts in a new game.
|
|
|
| Report Abuse |
|
|
AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 01:28 AM |
In what script? the playerremoving one?
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
AuroJosh
|
  |
| Joined: 04 Oct 2015 |
| Total Posts: 484 |
|
|
| 13 Mar 2016 01:30 AM |
No.
#code print("Who is this you speak of?".."Dis is AuroJosh!") |
|
|
| Report Abuse |
|
|