|
| 22 May 2013 03:53 PM |
Heres the script: local Click = script.Parent Click.MouseButton1Down:connect(function() if game.Workspace.Game.Joinable.Value == true then player.PlayerGui.CamMode:remove() player.PlayerGui.CamFix:remove() reds=game:service("Teams")["Alpha"] blues=game:service("Teams")["Bravo"] getspawnsb = game.Workspace.Map.BlueSpawns:GetChildren() getspawnsr = game.Workspace.Map.RedSpawns:GetChildren() player = script.Parent.Parent.Parent.Parent.Character if player.TeamColor == blues.TeamColor then player.Character:MoveTo((getspawnsb[math.random(1, #getspawnsb)]).Position + Vector3.new(0,5,0)) player.Character.Torso.CFrame = ((getspawnsb[math.random(1, #getspawnsb)]).CFrame + Vector3.new(0,5,0)) if player:findFirstChild("GiveItem") ~= nil then local theweapondemand = player.GiveItem.Value local gun = game.Lighting.Weapons[""..theweapondemand..""]:clone() gun.Parent = player.Backpack elseif player.TeamColor ~= reds.TeamColor then player.Character:MoveTo((getspawnsr[math.random(1, #getspawnsr)]).Position + Vector3.new(0,5,0)) player.Character.Torso.CFrame = ((getspawnsr[math.random(1, #getspawnsr)]).CFrame + Vector3.new(0,5,0)) if player:findFirstChild("GiveItem") ~= nil then local theweapondemand = player.GiveItem.Value local gun = game.Lighting.Weapons[""..theweapondemand..""]:clone() gun.Parent = player.Backpack end end end end end)
This is what i get in output: Players.Player1.PlayerGui.Play.Play.Script:4: attempt to index global 'player' (a nil value)
|
|
|
| Report Abuse |
|
|
|
| 22 May 2013 03:53 PM |
| This happens because player is nil, or undefined. |
|
|
| Report Abuse |
|
|
|
| 22 May 2013 03:56 PM |
I know i fixed that local Click = script.Parent Click.MouseButton1Down:connect(function() if game.Workspace.Game.Joinable.Value == true then reds=game:service("Teams")["Alpha"] blues=game:service("Teams")["Bravo"] getspawnsb = game.Workspace.Map.BlueSpawns:GetChildren() getspawnsr = game.Workspace.Map.RedSpawns:GetChildren() player = script.Parent.Parent.Parent.Parent player.PlayerGui.CamMode:remove() player.PlayerGui.CamFix:remove() if player.TeamColor == blues.TeamColor then player.Character:MoveTo((getspawnsb[math.random(1, #getspawnsb)]).Position + Vector3.new(0,5,0)) player.Character.Torso.CFrame = ((getspawnsb[math.random(1, #getspawnsb)]).CFrame + Vector3.new(0,5,0)) if player:findFirstChild("GiveItem") ~= nil then local theweapondemand = player.GiveItem.Value local gun = game.Lighting.Weapons[""..theweapondemand..""]:clone() gun.Parent = player.Backpack elseif player.TeamColor ~= reds.TeamColor then player.Character:MoveTo((getspawnsr[math.random(1, #getspawnsr)]).Position + Vector3.new(0,5,0)) player.Character.Torso.CFrame = ((getspawnsr[math.random(1, #getspawnsr)]).CFrame + Vector3.new(0,5,0)) if player:findFirstChild("GiveItem") ~= nil then local theweapondemand = player.GiveItem.Value local gun = game.Lighting.Weapons[""..theweapondemand..""]:clone() gun.Parent = player.Backpack end end end end end)
But now i dont get anything a all in output! D: |
|
|
| Report Abuse |
|
|
|
| 22 May 2013 04:00 PM |
| So i tested it and know only if the player is on the blue team it works but not if there on red D:< |
|
|
| Report Abuse |
|
|
|
| 22 May 2013 04:02 PM |
if player.TeamColor == blues.TeamColor then
elseif player.TeamColor ~= reds.TeamColor then
If they be blue, then checks if they're NOT red |
|
|
| Report Abuse |
|
|
|
| 22 May 2013 04:21 PM |
Oh, so what i planned on having it do is to check if the player is on the blue team then does the lines below And if the players on red then runs the lines below that :/ |
|
|
| Report Abuse |
|
|
|
| 22 May 2013 04:24 PM |
Here is what i currently got: local Click = script.Parent Click.MouseButton1Down:connect(function() if game.Workspace.Game.Joinable.Value == true then reds=game:service("Teams")["Alpha"] blues=game:service("Teams")["Bravo"] getspawnsb = game.Workspace.Map.BlueSpawns:GetChildren() getspawnsr = game.Workspace.Map.RedSpawns:GetChildren() player = script.Parent.Parent.Parent.Parent if player:findFirstChild("GiveItem") then player.PlayerGui.CamMode:remove() player.PlayerGui.CamFix:remove() local theweapondemand = player.GiveItem.Value local gun = game.Lighting.Weapons[""..theweapondemand..""]:clone() gun.Parent = player.Backpack if player.TeamColor == blues.TeamColor then player.Character:MoveTo((getspawnsb[math.random(1, #getspawnsb)]).Position + Vector3.new(0,5,0)) player.Character.Torso.CFrame = ((getspawnsb[math.random(1, #getspawnsb)]).CFrame + Vector3.new(0,5,0)) elseif player.TeamColor ~= reds.TeamColor then player.Character:MoveTo((getspawnsr[math.random(1, #getspawnsr)]).Position + Vector3.new(0,5,0)) player.Character.Torso.CFrame = ((getspawnsr[math.random(1, #getspawnsr)]).CFrame + Vector3.new(0,5,0)) end end end end) |
|
|
| Report Abuse |
|
|
|
| 22 May 2013 04:28 PM |
| Nvm the script i just posted works, XD |
|
|
| Report Abuse |
|
|