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

Vector 3 expected, got userdata error?

Asked by 9 years ago

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)

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

1 answer

Log in to vote
0
Answered by 9 years ago

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!

Ad

Answer this question