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

how to use objectvalues?

So I'm trying to make my self check-in easier to set up, I have this code:

local class1name = scisettings.Class1Name
local class1card = scisettings.Class1Card
local Player = game.Players.LocalPlayer
local card1 = game.ServerStorage.class1card.Value

I don't know how to use object values, so please tell me lol Error by the way:class1card is not a valid member of ServerStorage

2 comments

0

Is there a value named "class1card" in ServerStorage?

0

It's an objectvalue

1 answer

✓ Accepted answer

According to this : An ObjectValue is an object whose purpose is to store a single reference to another object.

I don't actually use ObjectValue, but it seems to me like it's a variable (any variable type) that can be accessed by every script like StringValue. I'm not sure so don't take my word for it...

It can be used like StringValue, IntValue, and BoolValue. Example (from developer.roblox.com)

local objectValue = Instance.new("ObjectValue")  --This makes an ObjectValue instance
objectValue.Name = "MyBaseplateReference"  --Renames the ObjectValue
objectValue.Value = workspace:FindFirstChild("Baseplate")  --And This sets the variable
objectValue.Parent = workspace  --Changes the Parent to workspace

About your error, Try...

local card1 = game.ServerStorage:WaitForChild("class1card").Value

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