BodyAngularVelocity Script Problem

Hey!!! I have a problem with my script, the BodyAngularVelocity does not increase, the figures remain static (i.e. a 0.1). Why?

print("Go")
local bav = script.Parent.Cube.Cube.BodyAngularVelocity
bav.angularvelocity = Vector3.new(0.1,0.1,0.1)

script.Parent.TimeValue.Value = 5

while true do
	local x = math.random(0.1,0.5)
	local y = math.random(0.1,0.5)
	local z = math.random(0.1,0.5)
	bav.angularvelocity = bav.angularvelocity + Vector3.new(x,y,z)
	wait(1)
	script.Parent.TimeValue.Value = script.Parent.TimeValue.Value - 0.7
end

I believe the problem is the capitalization, as the AngularVelocity property is capitalized on the A and the V. Fixing the capitalization might fix it, since i dont see any other errors.

it doesn’t change anything, I think the problem is the math.random() because I think it doesn’t support decimal numbers.

math.random supports decimal numbers. Are there any errors?

I don’t have an error, but when I put an integer number, for example, 1, it works, but if I put for example 0.5, it doesn’t work.

math.random doesn’t support decimal numbers to get them use this code

"0."..math.random(1,5)

EDIT: if you want it to have more decimal places you can change it to like

"0.00"..math.random(1,5)
2 Likes

Oh! It works ! tysm! :happy1: !

No problem! hope your code and whatever your using it for turns out well

1 Like