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

ServerScriptService.DataStore:82: bad argument #3 to 'Value' (BrickColor expected, got number) ?

Asked by 5 years ago
local PrimaryColor = Instance.new("BrickColorValue",Storage)
    PrimaryColor.Name = "PrimaryColor"
    PrimaryColor.Value = PrimaryColor1:GetAsync(player.UserId) or BrickColor.Random()
    PrimaryColor.Changed:connect(function()
    PrimaryColor1:SetAsync(player.UserId,PrimaryColor.Value)
    end)

At line 3.

0
Thanks beforehand xd bibino1 5 — 5y
0
It would be nice to see the color value modified before the script. I can't really understand the issue fully yet. GetGlobals 343 — 5y
0
You can't store userdatas in data stores. A BrickColor is considered a userdata. You may want to save the name of the BrickColor (PrimaryColor.Value.Name), BrickColors have a Name property. User#19524 175 — 5y
0
The constructor for the brick color would then be BrickColor.new(PrimaryColor.Value.Name). User#19524 175 — 5y
0
Oh, I’ll try this method when I get home. Thx bibino1 5 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

the thing your doing wrong is that your using a BrickColorValue, not a Color3Value if there is one but BrickColors arent numbers though words like Really red. Im not sure whats PrimaryColor1 nor Storage, but i guess its a number of some sort. I just looked at the error lol so im not sure

also the parent parameter of Instance.new() is decaperated, set the parent last such as this:

not

local ack = Instance.new("Part", workspace)

ack.Name = "hi"

this

local ack = Instance.new("Part")

ack.Name = "hi"
ack.Parent = workspace  
Ad

Answer this question