Script to change the speed of a spinning platform not working

I am trying to make a spinning part that first starts rotating slowly, and then gradually spins faster.

This is what the spinning part looks like in action: spinner

I want the AngularVelocity to be changed by a script, so it will gradually change the speed, but whenever I play the game, the platform keeps spinning the same speed I set it to in properties. I don’t get any errors or anything, but it’s just like the script isn’t running. (The script is in the HingeConstraint)

speed = script.Parent.AngularVelocity
speed = 0

while true do
	wait(1)
	speed += 1
end

I am not sure if this is a scripting issue or a physics issue, but I am putting it under Scripting Support because I think the problem is from the script.

If you have any ideas on how this can be solved, please let me know! I would really appreciate it.

2 Likes

Hello! For starter, I recommend using TweenService to animate your part, and then adjusting the speed accordingly.

1 Like

Is it giving any errors if so send a picture of it pls.

1 Like

I think it needs to be like this
This was not working because it is saying += but it needs to be like this

local speed = script.Parent

while true do
	wait(1)
	speed.AngularVelocity = speed.AngularVelocity + 1
end
1 Like

The script is incorrect.

If it’s parented to something else:

local speed = script.Parent.AngularVelocity
speed.MaxToruqe = math.huge -- set the maximum length it can go
speed.AngularVelocity = Vector3.new(0, 0, 0) -- AngularVelocity is a vector3, not a number

while true do
	wait(1)
	speed.AngularVelocity += Vector3.new(1, 0, 0) 
end

If it’s parented to the AngularVelocity:

local speed = script.Parent
speed.MaxToruqe = math.huge
speed.AngularVelocity = Vector3.new(0, 0, 0) 

while true do
	wait(1)
	speed.AngularVelocity += Vector3.new(1, 0, 0) 
end

For clarification, is the script’s Parent the AngularVelocity or is it parented to something else?

2 Likes

That is a valid syntax in Luau (Roblox Lua)

oh is it cause it’s like this value

(255, 255, 255)

cause if it is then i am wrong and you are right i’m not really working with rotating thing so your thing will work probably not mine.

1 Like

The value type for AngularVelocity is a Vector3
You might be thinking of a Color3

They both use the same thing (3 numbers) but for different purposes.
Color3 is for colors while Vector3 is for CFrames and Positions.

local vect3 = Vector3.new(0, 10, 0) --> The "Y" Axis for this is "10"
local clr3 = Color3.fromRGB(255, 0, 0) --> The color for this is "Red"

Roblox Luau documentation:

well than you are right i did think because of hes value it was just a normal value like 1 ty for giving me information on that i never worked with any rotating part’s and stuff but i was trying to use it soon

1 Like