I’ve wrote some code to damage a player and spin a part but when I print the velocity it gives 0,0,0
local CS = game:GetService("CollectionService")
local Lasers = CS:GetTagged("Laser")
local Config = {
NormSpinSpd = 0.01;
Damage = 25;
DamageDelay = 0.75;
}
game.Players.PlayerAdded:Connect(function(plr)
plr:SetAttribute("LaserDB",false)
end)
for _, Laser in pairs(Lasers) do
Laser.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr and plr:GetAttribute("LaserDB") == false then
hit.Parent.Humanoid.Health -= Config.Damage
plr:SetAttribute("LaserDB",true)
task.wait(Config.DamageDelay)
plr:SetAttribute("LaserDB",false)
end
end
end)
end
while true do
script.Parent.Main.Laser.CFrame = script.Parent.Main.Laser.CFrame * CFrame.Angles(0,-Config.NormSpinSpd,0)
print(script.Parent.Main.Root.AssemblyAngularVelocity)
task.wait()
end
By setting the part’s cframe directly you’re effectively just teleporting the part. From it’s point of view, it’s just being teleported very quickly, making it look as if it’s rotating while it’s actual velocity is 0.
Velocity stuff isn’t being set. You’re changing rotation but not the physics velocity. You’re not using Delta time so the speed varies with lag, but it’s approximately NormSpinSpeed / math.pi * 648000 RPM.