local Ran = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, -1, -2, -3, -4, -5} local r = Ran[(math.random(1, 15))] Shot1.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r)-- CFrame Coordinates thingy Shot2.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r) Shot3.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r) Shot4.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r) Shot5.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r) Shot6.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r) Shot7.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r) Shot8.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r) Shot9.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r) Shot10.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r) Shot11.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r) Shot12.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r) Shot13.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r) Shot14.CFrame = Player.Character.Torso.CFrame*CFrame.new(r, r, r)
This should randomly select a number from the table called Ran and insert it in the CFrame Coordinates thingy. But its not working and I dont know why.
You have already defined "r" on line 3, this means that "r" will always be the same value. If you want a new value for each of these then you will need to replace all of the r's in the CFrame.new() sections to r() and make a new function that does this
local function r() return math.random(-5, 9) -- Returns a random number from -5 to 9 end
There was no need to write up a table of numbers for this. But incase in the future you may want to return something different, specific values, then here, you can use this
local function r() return Ran[math.random(#Ran)] -- No need to write (1, 15) because #Ran will give you the number end