BEART12
|
  |
| Joined: 22 Oct 2008 |
| Total Posts: 3190 |
|
|
| 19 Dec 2013 06:49 PM |
| Is there a built in statement so my script wont start to player loads? |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2013 06:50 PM |
| http://wiki.roblox.com/index.php/API:Instance/WaitForChild |
|
|
| Report Abuse |
|
|
BEART12
|
  |
| Joined: 22 Oct 2008 |
| Total Posts: 3190 |
|
|
| 19 Dec 2013 07:03 PM |
I did this and it caused my local script not to work. local Player = Game.Players.LocalPlayer game.Workspace:WaitForChild("Player") print("Player has spawned!") |
|
|
| Report Abuse |
|
|
Azarth
|
  |
| Joined: 17 Aug 2012 |
| Total Posts: 2760 |
|
|
| 19 Dec 2013 07:10 PM |
wait() local Player = game.Players.LocalPlayer game.Workspace:WaitForChild(Player.Name) print("Player has spawned!") |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 19 Dec 2013 07:10 PM |
Hmmm May be wrong,.,,,,,, a player is not in workspace......
local players = game.Player game.Players.PlayerAdded:connect(function(Player) if players:WaitForChild("Player") end end) |
|
|
| Report Abuse |
|
|
Azarth
|
  |
| Joined: 17 Aug 2012 |
| Total Posts: 2760 |
|
|
| 19 Dec 2013 07:13 PM |
--Edit, if you're doing this in a local script only.
game.Players:WaitForChild(game.Players.LocalPlayer.Name) print("found") |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2013 07:14 PM |
^ That script won't start until the Player is loaded. That's the thing about LocalScripts
repeat wait() until Player:findFirstChild("Character") |
|
|
| Report Abuse |
|
|
Azarth
|
  |
| Joined: 17 Aug 2012 |
| Total Posts: 2760 |
|
|
| 19 Dec 2013 07:16 PM |
| mhm, accidentally tested it after I had already spawned. |
|
|
| Report Abuse |
|
|
BEART12
|
  |
| Joined: 22 Oct 2008 |
| Total Posts: 3190 |
|
|
| 19 Dec 2013 07:18 PM |
Could someone send me a wiki on tables as i need to do...
Guns {MP40[Ammo = 100], [AmmoMax = 1000]}
If that's possible in tables. Thanks |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2013 07:22 PM |
Dictionaries http://wiki.roblox.com/index.php/Dictionary#Dictionaries
Example:
MyDictionary={ ["Apple"]="A fruit", ["SubTable"]={ a=1 } }
print(MyDictionary["Apple"]) - A fruit print(MyDictionary["SubTable"][1]) - 1 |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2013 07:23 PM |
For what you wanted:
Guns={ ["MP40"]={ ["Ammo"]=100, ["AmmoMax"]=1000 } } |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2013 07:23 PM |
local Gun = { Ammo = 100 AmmoMax = 1000 }
print("Max ammo is " .. Gun.AmmoMax) print("Current ammo is " .. Gun.Ammo)
|
|
|
| Report Abuse |
|
|
|
| 19 Dec 2013 07:24 PM |
^ He wants to put ALL the guns into a table named "Guns". That's why I said Dictionaries. |
|
|
| Report Abuse |
|
|
BEART12
|
  |
| Joined: 22 Oct 2008 |
| Total Posts: 3190 |
|
|
| 19 Dec 2013 07:31 PM |
wait before i do this can i get values out of them, because what i basicly want to do is this.
if ammo < Guns[Ammo] and StoredAmmo < Guns[StoredAmmo] then ---fill |
|
|
| Report Abuse |
|
|