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

attempt to concatenate a userdata value?

I'm trying to make a part teleport to a position using Vectors and its not working. Any help?

Script:

local SavePosOfPart1 = script.Parent.Teleporter.RealPosition1.Position

print(SavePosOfPart1)
script.Parent.Teleporter.Tele1.Position = Vector3.new(0,0,0)..SavePosOfPart1

3 comments

0

Why are you trying to concat Vector3.new with the position of SavePosOfPart1?

0

Vector3.new(0,0,0)+SavePosOfPart1 if you wanna add vectors

0

^ Thanks!

1 answer

✓ Accepted answer

You cannot concatenate a Vector3 value, but you can say: Vector3.new(SavePosOfPart1)

Vector3.new can take in a 3D object value's position too, which can be a part or even an attachment. Since a position property of the object has three numbers, x, y, z.

The reason why it says "attempt to concatenate a userdata value" is because it is under Roblox's custom made classes. Everything in the roblox game engine that is interactive is a class itself. These classes take in "userdata" values which can mean anything made by Roblox.

Here's your script fixed, if it doesn't work reveal some more code and tell me the error if it happens:

local SavePosOfPart1 = script.Parent.Teleporter.RealPosition1.Position

print(SavePosOfPart1)
script.Parent.Teleporter.Tele1.Position = Vector3.new(SavePosOfPart1)

I can't find too much about Vector3 on the wiki for some reason but here's an article that might help you out:

https://developer.roblox.com/en-us/api-reference/datatype/Vector3

3 comments

0

sorry if theres a big white patch of space in the middle of this post i dont know why it keeps happening, an ad might of wanted to display there but didnt.

0

Thank you!

0

your welcome

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