I made a script so that if the player moves, a part roates. I want to make it so that when the player is moving, the part only has a certain angle it can rotate to, but instead it just rotates continuously.
My gun that I need to fix: https://gyazo.com/aefbe2aa391d0a6fb80a404e47678299
Script:
local Player = game:GetService’Players’.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local aks = Character:WaitForChild(“aks”)
local main = Character.aks.Main
repeat wait() until Player.Character
local RunService = game:GetService(“RunService”)
local function updateBobbleEffect()
local now = tick()
if Character.Humanoid.MoveDirection.Magnitude > 0 then
Player.Character.Torso.Motor6D.C0 = Player.Character.Torso.Motor6D.C0 * CFrame.Angles(0, 0, math.rad(0.5))
print((“lol”))
else
print(“no”)
end
end
RunService.RenderStepped:Connect(updateBobbleEffect)