This is where I'm at and I kinda got tunnel vision when making the rotate model. What would be the most efficient random y axis change?
local model = script.Parent local mainPart = model.Base
--Rotation values (in degrees):
local rotX = 0.1 local rotY = 0.1 local rotZ = 0.1
local delay = 0.01 -- delay between each "Frame"
local mTable = {} local offsetTable = {}
function getListOfParts(inst) for i, v in pairs(inst:GetChildren()) do if v:isA("BasePart") then table.insert(mTable, v) else getListOfParts(v) end end end
getListOfParts(model)
for i, v in pairs(mTable) do offsetTable[i] = mainPart.CFrame:toObjectSpace(mTable[i].CFrame) end
while wait(delay) do mainPart.CFrame = mainPart.CFrame * CFrame.Angles(math.rad(rotX), math.rad(rotY), math.rad(rotZ)) for i, v in pairs(mTable) do v.CFrame = mainPart.CFrame * offsetTable[i] end end
I believe what you're looking for is the math function math.random()
You can change your rotY variable to this
local rotY = math.random(0.01,1)
The parameters for math.random is
math.random(MinimumValue,UpperValue)
Also T0XN is correct, please use code blocks next time you make a post, to use codeblocks highlight your code, and press the blue Lua button