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 » Scripters
Home Search
 

Re: Problem with a variable

Previous Thread :: Next Thread 
iceman72 is not online. iceman72
Joined: 08 Jun 2008
Total Posts: 786
16 Dec 2014 06:35 PM
Below is two scripts, they should do the same thing, but only the second one works. What did I do wrong with the variables?

key = {"Money","FirstVisit","LastVisit","TotalTime","Kills","Deaths")

function playerEnter (player)
local pSlot = script.Players:FindFirstChild(player.Name)

Instance.new("Model",script.Players).Name = player.Name

Instance.new("IntValue",pSlot).Name = "Score"
Instance.new("StringValue",pSlot).Name = "FootNote"

for i,v in pairs (key) do --Adding regular fields
Instance.new("IntValue",(pSlot)).Name = v
end

end


game.Players.PlayerAdded:connect(playerEnter)

key = {"Money","FirstVisit","LastVisit","TotalTime","Kills","Deaths")

function playerEnter (player)
Instance.new("Model",script.Players).Name = player.Name

Instance.new("IntValue",script.Players:FindFirstChild(player.Name)).Name = "Score"
Instance.new("StringValue",script.Players:FindFirstChild(player.Name)).Name = "FootNote"

for i,v in pairs (key) do --Adding regular fields
Instance.new("IntValue",(pSlot)).Name = v
end

end

game.Players.PlayerAdded:connect(playerEnter)
Report Abuse
iceman72 is not online. iceman72
Joined: 08 Jun 2008
Total Posts: 786
16 Dec 2014 07:23 PM
Nvm I am dumb... but smart for finding it! so just regular I guess.
Anyone who cares its that I defined pSlot before I make the Model that it refranced
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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