Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 20 Jul 2016 12:24 AM |
local peoplealive = game.ServerScriptService:WaitForChild("Main"):WaitForChild("PeopleAlive") local sheriff = peoplealive.Parent:WaitForChild("Sheriff") local memer = peoplealive.Parent:WaitForChild("Memer") humanoid.Died:connect(function() _G.EndRound("Innocent", memer, sheriff) end)
EVERY DARN TIME THE LAST TWO ARGUMENTS ARE NIL, AND I GET THIS ERROR:
attempt to index local 'sheriff' (a nil value)
And the same for memer.
What on Earth? I am sure they are not nil so why is this happening?
u sicko! |
|
|
| Report Abuse |
|
|
| |
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 20 Jul 2016 12:27 AM |
@Hello Seriously: https://www.roblox.com/games/252336261/Alpha-COMING-SOON-The-Mad-Memer
Also seriously, why is it sending nil?
u sicko! |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2016 12:30 AM |
| can i see the variable for "Innocent"? |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 20 Jul 2016 12:35 AM |
I don't need one for innocent, this script goes inside the Memer's humanoid so I can easily keep track of him dying.
This is the whole script:
local character = script.Parent.Parent local humanoid = script.Parent local peoplealive = game.ServerScriptService:WaitForChild("Main"):WaitForChild("PeopleAlive") local sheriff = peoplealive.Parent:WaitForChild("Sheriff") local memer = peoplealive.Parent:WaitForChild("Memer") humanoid.Died:connect(function() print(memer.Value) print(sheriff.Value) _G.EndRound("Innocent", memer, sheriff) end)
peoplealive.Changed:connect(function() if peoplealive.Value == 1 and humanoid.Health >0 then _G.EndRound("Memer", memer, sheriff) end end)
Basically when I use the arguments in my global script (Which will be turned into modules after I fix this) it acts like sheriff and memer are nil.
u sicko! |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2016 12:39 AM |
can you try and do this? local peoplealive = game.ServerScriptService:WaitForChild("Main").PeopleAlive |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 20 Jul 2016 12:42 AM |
Still returns the same error.
Here's the function if it helps:
_G.EndRound = function(winner, memer, sheriff) print(sheriff.Value)--Returns error. game.ServerScriptService.Main.PeopleAlive.Value = false local lobby = game.Workspace.Lobby --local winner = game.ServerScriptService.Main.Winner for i, l in pairs(lobby:GetChildren()) do if l:IsA("BasePart") then l.BrickColor = BrickColor.Random() elseif l:IsA("Model") then for i, m in pairs(l:GetChildren()) do if m:IsA("BasePart") then m.BrickColor = BrickColor.Random() end end end end for i,v in pairs(game.Workspace:GetChildren()) do if game.Players:FindFirstChild(v.Name) ~= nil then v.Humanoid.Health = 0 end end game.ServerScriptService.Main.PeopleAlive.Value = 0 wait(8) for i,v in pairs(game.Players:GetPlayers()) do local frame = v.PlayerGui.Winner.Frame frame.Sheriff.Value = sheriff.Value frame.Memer.Value = memer.Value frame.Visible = true frame.WhoWon.Text = "The "..winner.." won!" if winner == "Nobody" then frame.WhoWon.Text = "Nobody won!" end end end
u sicko! |
|
|
| Report Abuse |
|
|
Raphael7
|
  |
| Joined: 03 Dec 2008 |
| Total Posts: 2479 |
|
|
| 20 Jul 2016 12:56 AM |
| What class is the sheriff? |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 20 Jul 2016 12:59 AM |
They're both ObjectValues.
I'm starting to wonder if it is because I'm using global functions...
u sicko! |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2016 01:15 AM |
| If you are using _G to interact between client and server in fe it won't work. |
|
|
| Report Abuse |
|
|