|
| 30 Apr 2016 08:19 PM |
So here I made a code for a round engine for my game ,but for some reasons , it doesnt react, doesnt show any error or anything in all the output(client and server). It supposed to give players role for the game etc.
local Time = 10 local Round = Instance.new("BoolValue",game.ServerStorage) local DictatorValue = Instance.new("StringValue",game.ServerStorage) DictatorValue.Name = "Dictator" DictatorValue.Value = "" Round.Name = "Round" Round.Value = false
function SetRole() local Players = game.Players:GetChildren() repeat wait() until #Players > 1 local Crib = game.Players:GetChildren() Dictator = Players[math.random(1,#Crib)] DictatorValue.Value = Dictator.Name print(Dictator.Name .. " is the dictator.") GetGui() end
while wait() do if Round.Value == false then Round.Value = true NewGame() SetRole() ShowDictator() print("New game") repeat wait(60) Time = Time - 1 until Time == 0 or Time <= 0 Reset() print("End of game") wait(1) Time = 10 Round.Value = false end end
|
|
|
| Report Abuse |
|
|
|
| 01 May 2016 10:39 AM |
| 13 views , no replies. Help plz. |
|
|
| Report Abuse |
|
|
|
| 01 May 2016 10:52 AM |
| Do , you just read it and copy it? Still waiting for help! |
|
|
| Report Abuse |
|
|
BanTech
|
  |
| Joined: 31 Dec 2015 |
| Total Posts: 886 |
|
|
| 01 May 2016 10:55 AM |
| You've not even given us all the code, so how are we meant to find the error? The loop you've sent seems okay but it references loads of functions that we can't see, so the problem is probably with one of those functions. |
|
|
| Report Abuse |
|
|
|
| 01 May 2016 10:56 AM |
| The others part of the code is just graphic , the others function work properly I've tested them before I changed these scripts. These are the only script not working. |
|
|
| Report Abuse |
|
|
|
| 01 May 2016 10:56 AM |
just add print statements to random lines of your script then go ingame and see how far it goes so you can locate where the issue is
does not compute |
|
|
| Report Abuse |
|
|
|
| 01 May 2016 11:03 AM |
I think my error is with this part ,because I want more than 1 player in the game and since I changed this, the whole script broken. Help please, I want to keep verifying until there more then 1 player who join..
function SetRole() local Players = game.Players:GetChildren() repeat wait() until #Players > 1 local Crib = game.Players:GetChildren() Dictator = Players[math.random(1,#Crib)] DictatorValue.Value = Dictator.Name print(Dictator.Name .. " is the dictator.") GetGui() end |
|
|
| Report Abuse |
|
|
|
| 01 May 2016 11:07 AM |
"DictatorValue.Value = Dictator.Name" math.random(1,#Crib) will only give you a number, try
DictatorValue.Value = Players[Dictator]
|
|
|
| Report Abuse |
|
|
|
| 01 May 2016 11:14 AM |
| I found a way how to fix this. |
|
|
| Report Abuse |
|
|