Hello, I’m trying to use LinearVelocity and AngularVelocity to make some parts spin and it probably makes sense to have this done on the client since it’s not for anything important, however, for some reason when it’s done on the client the constraints aren’t doing anything. I tested the code on the server and it worked fine, but it’s probably inefficient to have it on the server.
I don’t think there is anything wrong with the code, but here it is anyways.
local function Spin(part)
part.Anchored = false
local attachment = Instance.new("Attachment")
attachment.Parent = part
local lv = Instance.new("LinearVelocity")
lv.Attachment0 = attachment
lv.MaxForce = math.huge
lv.VectorVelocity = Vector3.new(0,0,0)
lv.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
lv.Parent = part
local av = Instance.new("AngularVelocity")
av.Attachment0 = attachment
av.AngularVelocity = Vector3.new(math.random(-8,8)/2,math.random(-8,8)/2,math.random(-8,8)/2)
av.MaxTorque = math.random(400,800)
av.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
av.Parent = part
end
for _,model in ipairs(UIAssets:GetChildren()) do
if model:IsA("Model") and model.Name == "Cube" then
Spin(model.Inner)
end
end