Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Value is not a valid number of BoolValue??

I'm trying to make a very basic simulator and i'm not having any luck. I've followed 3 different tutorials and It's all the same error for me. " value is not a valid number of BoolValue "Players.MyUsername.leaderstats"

Here's my leaderstats script

local player = game.Players.PlayerAdded:Connect(function(player)

local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player

local strength = Instance.new("NumberValue")
strength.Name = "Treats"
strength.Parent = leaderstats

local cash = Instance.new("NumberValue")
cash.Name = "Bones"
cash.Parent = leaderstats

end)


The local script used inside the bone (tool)

local player = game.Players.LocalPlayer script.Parent.Activated:Connect(function() local leaderstats = player:WaitForChild("leaderstats") player.leaderstats.Strength.Value = player.leaderstats.value + 1

end)


I have another leaderstats script

local player = game.Players.LocalPlayer script.Parent.Activated:Connect(function() local leaderstats = player:WaitForChild("leaderstats") player.leaderstats.Strength.Value = player.leaderstats.value + 1

end)

The error pops up whenever i use my tool / click. I don't know what to do since i followed these scripts off of a tutorial but i've completely set the project aside until i can figure this out.

A picture of the error as well: https://i.imgur.com/1NBqhu9.png

3 answers

This is your issue:

local player = game.Players.LocalPlayer script.Parent.Activated:Connect(function()
    local leaderstats = player:WaitForChild("leaderstats") 
    player.leaderstats.Strength.Value = player.leaderstats.value + 1
end)

this should be:

local player = game.Players.LocalPlayer script.Parent.Activated:Connect(function()
    local leaderstats = player:WaitForChild("leaderstats") 
    player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + 1
end)

Hello there!

You have a little mistake with Instance.new. As far as I know NumberValue doesn't exist. Here's the fixed script:

local player = game.Players.PlayerAdded:Connect(function(player)

local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
	 
local strength = Instance.new("IntValue") -- IntValue not NumberValue
strength.Name = "Treats"
strength.Parent = leaderstats
 
local cash = Instance.new("IntValue") -- Same thing
cash.Name = "Bones"
cash.Parent = leaderstats
end)


You have more errors, tools having a principal problem (Change strength to the value you want to be changed)

3 comments

0

Leaderstats one btw

0

NumberValue exists - it allows decimals, such as 7.3

0

Oh my bad, I never seen one in my life

NumberValue does exist in Roblox, the difference is NumberValue is a float and IntValue is an int value as it says. The error here is that they tried to use leaderstats.value which does not exist, if you meant leaderstats.Strength.Value then fix your script, if you did not then explain it further so we can understand.

This discussion is preserved as it was. New answers, comments, and votes are closed.