1.What do you want to achieve?
I want to fix my third person system
-
What is the issue?
Character is shaking when i point camera up or down -
What solutions have you tried so far?
I’ve been searching on youtube and roblox forum
Video:
Code:
local LoadedAnimation = game.Players.LocalPlayer.Character.Humanoid.Animator:LoadAnimation(script.Hold)
local equiped = false
local gyro
local char = game.Players.LocalPlayer.Character
local rootpart : Part = char:FindFirstChild("HumanoidRootPart")
script.Parent.Equipped:Connect(function()
equiped = true
LoadedAnimation:Play()
gyro = Instance.new("BodyGyro", rootpart)
gyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
gyro.P = 15000
end)
script.Parent.Unequipped:Connect(function()
equiped = false
if LoadedAnimation then
LoadedAnimation:Stop()
end
if gyro then
gyro:Destroy()
end
end)
local rs = game:GetService("RunService")
for _, index in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
if index:IsA("BasePart") and index.Name ~= "Head" and index.Name ~= "Right Arm" and index.Name ~= "Left Arm" and index.Name ~= "Torso" then
index:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
index.LocalTransparencyModifier = index.Transparency
end)
index.LocalTransparencyModifier = index.Transparency
end
end
local mouse = game.Players.LocalPlayer:GetMouse()
local debounce = false
local damage = 80
local spread = 1
local smth = 1
local function Fire()
local x = math.random(-spread*100,spread*100)/100
local y = math.random(-spread*100,spread*100)/100
local direction = (CFrame.new(script.Parent.Handle.Position, mouse.Hit.Position) * CFrame.Angles(math.rad(x), math.rad(y), 0)).LookVector
local ray = Ray.new(script.Parent.Handle.Position,(direction).Unit * 999)
local part, pos = workspace:FindPartOnRay(ray, game.Players.LocalPlayer.Character)
if part then
script.Parent.Shoot:FireServer(part,pos,damage)
end
end
mouse.Button1Down:Connect(function()
if equiped then
for i=1, smth do
Fire()
end
end
end)
rs.RenderStepped:Connect(function()
if equiped then
char:FindFirstChild("Humanoid").AutoRotate = false
local x, y, z = workspace.CurrentCamera.CFrame:ToObjectSpace()
gyro.CFrame = workspace.CurrentCamera.CFrame
end
end)