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: Player:Wait Question

Previous Thread :: Next Thread 
BEART12 is not online. 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
Vaporation is not online. Vaporation
Joined: 08 Jun 2011
Total Posts: 1397
19 Dec 2013 06:50 PM
http://wiki.roblox.com/index.php/API:Instance/WaitForChild
Report Abuse
BEART12 is not online. 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 is not online. 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 is not online. 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 is not online. 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
RobustCapable is not online. RobustCapable
Joined: 09 Dec 2013
Total Posts: 82
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 is not online. 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 is not online. 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
RobustCapable is not online. RobustCapable
Joined: 09 Dec 2013
Total Posts: 82
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
RobustCapable is not online. RobustCapable
Joined: 09 Dec 2013
Total Posts: 82
19 Dec 2013 07:23 PM
For what you wanted:

Guns={
["MP40"]={
["Ammo"]=100,
["AmmoMax"]=1000
}
}
Report Abuse
Vaporation is not online. Vaporation
Joined: 08 Jun 2011
Total Posts: 1397
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
RobustCapable is not online. RobustCapable
Joined: 09 Dec 2013
Total Posts: 82
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 is not online. 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
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