Hello!
Does anybody know how to make viewmodel smoother and sync with tools?
local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local tweenService = game:GetService("TweenService")
local info = TweenInfo.new(0, Enum.EasingStyle.Quart, Enum.EasingDirection.Out, 0, false, 0)
local spawned = false
local VM = game:GetService("ReplicatedStorage").VM
local Mouse = Player:GetMouse()
local MouseDelta = game:GetService("UserInputService"):GetMouseDelta()
local welded = false
if Char:FindFirstChildOfClass("Shirt") then
Char:WaitForChild("Shirt"):Clone().Parent = VM
end
if Char:FindFirstChildOfClass("BodyColors") then
Char:WaitForChild("Body Colors"):Clone().Parent = VM
end
wait(2.5)
VM.Parent = Camera
local hrp = Char.HumanoidRootPart
game:GetService("RunService").Stepped:Connect(function()
local distance = (hrp.Position + hrp.CFrame.UpVector * 1.5 - Camera.CoordinateFrame.Position).Magnitude
if distance <= 1 then
Char["Left Arm"].Transparency = 1
Char["Right Arm"].Transparency = 1
tweenService:Create(VM["Right Arm"], info, {Orientation = Char:WaitForChild("Right Arm").Orientation}):Play()
tweenService:Create(VM["Right Arm"], info, {Position = Char:WaitForChild("Right Arm").Position}):Play()
tweenService:Create(VM["Left Arm"], info, {Orientation = Char:WaitForChild("Left Arm").Orientation}):Play()
tweenService:Create(VM["Left Arm"], info, {Position = Char:WaitForChild("Left Arm").Position}):Play()
VM["Right Arm"].Transparency = 0
VM["Left Arm"].Transparency = 0
else
VM["Right Arm"].Transparency = 1
VM["Left Arm"].Transparency = 1
Char["Left Arm"].Transparency = 0
Char["Right Arm"].Transparency = 0
end
end)