How do I fix the attempt to index number with 'Name' error in Roblox?
Asked by
2 years ago Edited 2 years ago
I don't know the answer to this solution, and here is my code, also I'm trying to just set a name of an IntValue inside a playerAdded function. Here is my code:
01 | game.Players.PlayerAdded:Connect( function (plr) |
02 | local leaderstats = Instance.new( 'Folder' ) |
03 | leaderstats.Name = 'leaderstats' |
04 | leaderstats.Parent = plr |
06 | local Clicks = Instance.new( 'IntValue' ) |
08 | Clicks.Name = 'clicks' |
09 | Clicks.Parent = leaderstats |
11 | local Rebirths = Instance.new( 'IntValue' ) |
12 | Rebirths.Name = 'rebirths' |
14 | Rebirths.Parent = leaderstats |
16 | local SuperRebirths = Instance.new( "IntValue" ) |
17 | SuperRebirths.Name = 'Super Rebirths' |
18 | SuperRebirths.Value = 0 |
19 | SuperRebirths.Parent = leaderstats |
21 | local PlayerData = Instance.new( 'Folder' ) |
22 | PlayerData.Name = plr.Name |
23 | PlayerData.Parent = game.ServerStorage.DataFolder |
25 | local OneRebirthCost = Instance.new( 'IntValue' ) |
27 | OneRebirthCost.Name = 'OneRebirthCost' |
28 | OneRebirthCost.Parent = game.ServerStorage.DataFolder:WaitForChild(plr.Name) |
The place I'm trying to make an IntValue is here:
1 | local OneRebirthCost = Instance.new( 'IntValue' ) |
3 | OneRebirthCost.Name = 'OneRebirthCost' |
4 | OneRebirthCost.Parent = game.ServerStorage.DataFolder:WaitForChild(plr.Name) |
I haven't found any solutions yet.
Also all this code is in a Server Script inside ServerScriptService.