1AmMeUwU
(BarryBean)
#1
-
What do you want to achieve?
I want to move a model to a position in workspace using a variable
-
What is the issue?
I have no idea how to do this
-
What solutions have you tried so far?
I have tried putting parenthesis around targetcombine and thats it.
-- wait(1)
local targetnumber = 1
local pieces = game.ReplicatedStorage.Pieces:GetChildren()
local randomPiece = pieces[math.random(1, #pieces)]
local targetFolder = game.Workspace.Targets
print(randomPiece)
local clonedpiece = randomPiece:Clone()
clonedpiece.Parent = workspace
local targetcombine = "CloneTarget"..targetnumber
print(targetcombine)
clonedpiece:MoveTo(targetFolder.targetcombine.Position)
sonic_848
(killer)
#2
Try using Model:PivotTo
instead. It uses a CFrame not a vector3 btw
1 Like
1AmMeUwU
(BarryBean)
#3
I tried using pivotTo but it doesn’t change the position
sonic_848
(killer)
#4
What is target combine? Is it like a part?
1AmMeUwU
(BarryBean)
#5
I was trying to make a variable that combines a number and CloneTarget
sonic_848
(killer)
#6
Can to
Try switching it to this:
targetFolder[`CloneTarget{targetnumber}`].Position
@1AmMeUwU New edits
1AmMeUwU
(BarryBean)
#7
Gave me this in the output
Unable to cast Vector3 to CoordinateFrame
sonic_848
(killer)
#9
Try using this. It converts the string as well
1AmMeUwU
(BarryBean)
#10
Sorry I messed up I was using pivotTo instead of moveto it is working now