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

Value is not a valid number of BoolValue??

Asked by 2 years ago

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

Log in to vote
1
Answered by
bbissell 346 Moderation Voter
2 years ago

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)
Ad
Log in to vote
0
Answered by
SuperPuiu 497 Moderation Voter
2 years ago
Edited 2 years ago

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)

0
Leaderstats one btw SuperPuiu 497 — 2y
0
NumberValue exists - it allows decimals, such as 7.3 sngnn 274 — 2y
0
Oh my bad, I never seen one in my life SuperPuiu 497 — 2y
Log in to vote
0
Answered by
enes223 327 Moderation Voter
2 years ago
Edited 2 years ago

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.

Answer this question