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

Getting an Object error when attempting to find ID Value in Workspace?

Hello,

I'm trying to find an object in the workspace by using a value. When printing the value, it prints out the value "WM830" as a string. But it's not finding the model in the workspace.

This is the code:

script.Parent.MouseButton1Click:connect(function()
	local busId = script.Parent.Parent.Parent.Car.value
	game.Workspace[busId].Body.Display.maindest.SurfaceGUI.TextLabel.text = "Woop"
end)

This is the error: Players.E_Link.PlayerGui.A-Chassis Interface.NXUI.TextButton.Script:3: bad argument #2 to '?' (string expected, got Object)

1 answer

Value classes have a Value property that contains the value.

Change line 2 to:

local busId = script.Parent.Parent.Parent.Car.value.Value

5 comments

0

Didn't work, getting this error:

0

value is not a valid member of Model

0

Your "value" instance simply doesn't exist then.

0

But it does, because I've printed it..

0

Provide us with all code associated with this issue.

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