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: The script can't find the file with the player name

Previous Thread :: Next Thread 
DeGames is not online. DeGames
Joined: 08 Sep 2012
Total Posts: 1028
23 Apr 2016 09:43 AM
I have a stats folder that I want to be linked to each player.
The folder is replicated from SeverStorage and put in ReplicatedStorage and named to each player's names.
game.Players.PlayerAdded:connect(function(player)
local stats = game.ServerStorage.Stats:Clone()
stats.Name = player.Name
stats.Parent = game.ReplicatedStorage
end)

Now I'm trying to access this folder from a script within a ScreenGui setup.

local sp = script.Parent
local player = sp.Parent.Parent.Parent.Parent.Parent
local playerName = player.Name
repeat wait() until player.Character
local stats = game.ReplicatedStorage.playerName --This is line 8


The output I get is
10:35:23.332 - playerName is not a valid member of ReplicatedStorage
10:35:23.353 - Script 'Players.Player1.PlayerGui.ClassSelection.Main.Classes.Infantry.Script', Line 8

Thanks
Report Abuse
eRanged is online. eRanged
Joined: 15 Jun 2013
Total Posts: 9746
23 Apr 2016 09:46 AM
local stats = game.ReplicatedStorage[playerName]

or

local stats = game.ReplicatedStorage:FindFirstChild(playerName)



Report Abuse
DeGames is not online. DeGames
Joined: 08 Sep 2012
Total Posts: 1028
23 Apr 2016 09:49 AM
Oh ok, thank you
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