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

Vector 3 expected, got userdata error?

So I get the (Vector3 expected, got userdata) error when I try to run this script, how do I fix it?

local EnterButton = script.Parent.EnterButton
local XBox = script.Parent.XBox.Text
local YBox = script.Parent.YBox.Text
local ZBox = script.Parent.ZBox.Text

EnterButton.MouseButton1Down:connect(function()
game.Workspace.Part11.Position = CFrame.new(XBox, YBox, ZBox)
end)

1 comment

0

Basically change CFrame.new() to Vector3.new() if that doesn't work then simply make sure the lines 2-4 include tonumber.

1 answer

Everything here looks correct to me.

Try this change and see if it works.

local EnterButton = script.Parent.EnterButton
local XBox = script.Parent.XBox.Text
local YBox = script.Parent.YBox.Text
local ZBox = script.Parent.ZBox.Text

EnterButton.MouseButton1Down:connect(function()
local Box = CFrame.new(XBox, YBox, ZBox)
game.Workspace.Part11:MoveTo(Box)
end)

or

local EnterButton = script.Parent.EnterButton
local XBox = script.Parent.XBox.Text
local YBox = script.Parent.YBox.Text
local ZBox = script.Parent.ZBox.Text

EnterButton.MouseButton1Down:connect(function()
game.Workspace.Part11:MoveTo(XBox, YBox, ZBox)
end)

Let me know how this works

If this helped, please accept the answer.

If there are any bugs let me know!

THANKS!

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