I want to assign a part positions using a table, i’ve tried mutiple things and nothing has worked yet. I have looked for solutions on the dev forum. Can someone help me out
local ranNumb = math.random(1)
CreateNewIndicatorTarget.Position = Vector3.new(indicatorsPos[1].x,indicatorsPos[1].y,indicatorsPos[1].z)
also change the table to this
local indicatorsPos = {
[1] = {[x]=46, [y]=0.1, [z]=60}
}
It kept cloning at 0,0,0 because if you print indicatorsPos[1] you’d get
[1]= number
[2]= number
[3]= number
and you can’t assign the table values as vector values
local indicatorsPos = {
--I recommend using arrays here so you can easily find random numbers using math.random
[1] = CFrame.new(22813.625, 1059.75, 2973.25) --this must be a CFrame value
}
function module.CreateTask()
local CreateNewIndicatorTarget = IndicatorTarget:Clone()
CreateNewIndicatorTarget.Parent = game.Workspace.RophoraPos
--math random needs a max value, just a 1 will always return 1
--With an array table, we can easily get the table length to use in math.random
local randomPos = indicatorsPos[math.random(1, #indicatorPos]]
CreateNewIndicatorTarget.CFrame = randomPos
--Infact, you use the exact same method here!
local FindTask = rophoraTasks[math.random(1, #rophoraTasks)]
player.PlayerGui.MainGui.Frame.TextLabel.Text = "Task:\t"..FindTask
end