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

attempt to concatenate a userdata value?

Asked by
imaA6D 39
4 years ago

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
0
Why are you trying to concat Vector3.new with the position of SavePosOfPart1? Raccoonyz 1092 — 4y
0
Vector3.new(0,0,0)+SavePosOfPart1 if you wanna add vectors greatneil80 2647 — 4y
0
^ Thanks! imaA6D 39 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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

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. 123nabilben123 499 — 4y
0
Thank you! imaA6D 39 — 4y
0
your welcome 123nabilben123 499 — 4y
Ad

Answer this question