How do I fix the error "Attempt to concatenate string with vector3?"
Hello, I am trying to clone a part inside another part, and make that part have a random place.
Here is my code:
01 | local smallRandom = math.random( 10 , 20 ) |
02 | local mediumRandom = math.random( 22 , 35 ) |
03 | local largeRandom = math.random( 38 , 50 ) |
05 | local x = script.Parent.Size.X/ 2 |
06 | local y = script.Parent.Size.Y/ 2 |
07 | local z = script.Parent.Size.Z/ 2 |
11 | local smallclone = game.Workspace.SmallScraps:Clone() |
13 | smallclone.Position = script.Parent.Position + Vector 3. new(math.random(-x, x), math.random(-y, y), math.random(-z, z)) |
15 | smallclone.Anchored = false |
16 | print ( "Part Spawned at " ..smallclone.Position) |
When I run it, the part never spawns and an error appears saying "Attempt to concatenate string with vector3"
I got this code from another place and modified it to fit my game, so I don't know how to fix this error.
Thank you.