generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Help!

Previous Thread :: Next Thread 
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
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
QuantumFieldTheory is not online. QuantumFieldTheory
Joined: 20 Oct 2012
Total Posts: 52
22 May 2013 03:53 PM
This happens because player is nil, or undefined.
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
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
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
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
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
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
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
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
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
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
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
22 May 2013 04:28 PM
Nvm the script i just posted works, XD
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image