So I'm trying to make some ice that moves around, so I unanchored it, added in a body gyro and velocity and position. I can't use the ~~~~~~~~~~~~~~~~~ math.random() ~~~~~~~~~~~~~~~~~ to change the velocity force so it moves around. Any help would be appreciated.
You could use the math.random
method for a Vector3 method, for it will choose a random Number value for the Vector3
argument(s), here's an example of what I mean;
local Part = game.Workspace:WaitForChild("Part") --Here's a random part Part.CFrame = CFrame.new(Part.Position + Vector3.new(math.random(1,2),math.random(1,2),math.random(1,2))) --And as you'll see, it'll switch positions each time :D
Sadly, I'm not too sure you can use the math.random
method for a CFrame
method, but, I'm just not sure, doesn't mean it may not work in a CFrame
method. :)
Hope this helped!
You can probably math.random each X,Y,Z value of Velocity
so something like
while true do script.Parent.Velocity.X = math.random(something,something) wait(something) script.Parent.Velocity.Y = math.random(something,something) wait(something) end