Lightsaber not spinning, but making the character go crazy

Just use hinge motor I guess, seems to be the simpliest solution.

Maybe this should work?

local spin = game.ReplicatedStorage.Remotes.SpinLightsaber

local RunService = game:GetService("RunService")

local players_spinning = {}

game.Players.PlayerAdded:Connect(function(plr)
	players_spinning[plr.Name] = false
end)

local ROTATE_ANGLE = 15 -- how much you want to rotate per second in degrees

spin.OnServerEvent:Connect(function(plr, spinning)
	local saber = plr.Character:FindFirstChildWhichIsA("Tool")
	
	local invisHand = saber.Handle
	
	players_spinning[plr.Name] = not players_spinning[plr.Name]
	
	while players_spinning[plr.Name] do
		local delta = RunService.Stepped:Wait()
		for i, motor in ipairs(invisHand:GetChildren()) do
			if motor:IsA("Motor6D") then -- because the handle attach is a weld
				motor.C0 = motor.C0 * CFrame.Angles(math.rad(delta * ROTATE_ANGLE), 0, 0)
			end
		end
	end
end)

game.Players.PlayerRemoving:Connect(function(plr)
	players_spinning[plr.Name] = nil
end)

Edit: Oops, I forgot to change it to a Motor6D

You literally changed this line:

to this line:

which will obviously do NOTHING AT ALL since the motor is still not a ‘Weld’.

Look at the edit, I forgot to change the type to a Motor6D, I’m aware of this now. I wasn’t fully sure to to how the saber was set up.

1 Like

Thanks, it worked a bunch! I just tweaked it to move slower and changed the math.rad(delta * 15) part to the Y axis.

1 Like