Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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:

01game.Players.PlayerAdded:Connect(function(plr)
02    local leaderstats = Instance.new('Folder')
03    leaderstats.Name = 'leaderstats'
04    leaderstats.Parent = plr
05 
06    local Clicks = Instance.new('IntValue')
07    Clicks.Value = 0
08    Clicks.Name = 'clicks'
09    Clicks.Parent = leaderstats
10 
11    local Rebirths = Instance.new('IntValue')
12    Rebirths.Name = 'rebirths'
13    Rebirths.Value = 1
14    Rebirths.Parent = leaderstats
15 
View all 28 lines...

The place I'm trying to make an IntValue is here:

1local OneRebirthCost = Instance.new('IntValue')
2OneRebirthCost = 25
3OneRebirthCost.Name = 'OneRebirthCost'
4OneRebirthCost.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.

2 answers

Log in to vote
0
Answered by 2 years ago

I think it's just a typo. You forgot to add .Value to a line

1OneRebirthCost = 25

Simply add .Value back like so

1local OneRebirthCost = Instance.new('IntValue')
2OneRebirthCost.Value = 25
3OneRebirthCost.Name = 'OneRebirthCost'
4OneRebirthCost.Parent = game.ServerStorage.DataFolder:WaitForChild(plr.Name)
Ad
Log in to vote
0
Answered by 2 years ago

are you using apostrophise '' instead of quotation marks ""? if you are try changing to quotation see if that works

0
I'm using single quotes starranger4 4 — 2y

Answer this question