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

Help With Userdata Value Issues?

Asked by
Scootakip 299 Moderation Voter
8 years ago

I need a string value in a player to constantly this part's position. This isn't the following script, cuz the rest of it works fine. In this line it says " attempt to concatenate field 'Position' (a userdata value)" and then doesn't change the value. Any help?

Player[script.Parent.ItemNumberPos.Value].Value = ""..script.Parent.PrimaryPart.Position..""
0
Vector3 values cannot be printed. Try printing .Position.X,.Position.Y,.Position.Z instead TheDeadlyPanther 2460 — 8y
0
It's working now. You should have said that in an answer though so I could give you a point of rep for that. Scootakip 299 — 8y

1 answer

Log in to vote
2
Answered by 8 years ago

In order to concatenate Position, or a Vector3, you would need to use the tostring() function. all tostring() does is makes numbers, userdatas, etc into a string so it can be concatenated or printed.

To fix your code,

Player[script.Parent.ItemNumberPos.Value].Value = tostring(script.Parent.PrimaryPart.Position)

I hope you've learned from this, and have an excellent day!

1
Another way to do this is to change Player[script.Parent.ItemNumberPos] to a Vector3Value, and not a StringValue. 0xDEADC0DE 310 — 8y
2
Thanks, man! Scootakip 299 — 8y
Ad

Answer this question