You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want the transition between my walking and idle animation to be smooth and not snap to the idle animation but instead for it to move and not instantly switch to the idle starting pose.
- What is the issue? Include screenshots / videos if possible!
The issue as you can see, is that the positioning of the weapon and the viewmodels arms snap to the starting pose of the idle anim. ZombieSurvival - Roblox Studio (gyazo.com)
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes, I have asked in discord servers, done research, tried using the parameters for Animation:Play(number of seconds) and also adjusted the animation.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
I am at a loss. I have looked into a animation weight function but I have no idea if that will fix the problem, or even how to use it.
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local PhysicsService = game:GetService("PhysicsService")
local Camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local mouseDown = false
local startedDown = 0
if Camera:FindFirstChild("ViewModel") then
Camera.ViewModel:Destroy()
end
local Character = script.Parent
local hrp = Character:WaitForChild("HumanoidRootPart")
local hum = Character:WaitForChild("Humanoid")
local Animator = Character:WaitForChild("Humanoid"):WaitForChild("Animator")
local ViewModel = game.ReplicatedStorage.weapons.SKSR15:Clone()
ViewModel.Parent = game.Workspace
local AnimControl = ViewModel:WaitForChild("AnimationController")
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
UIS.MouseIconEnabled = false
local movementstatus = false
--anims
local Idle = Instance.new("Animation")
Idle.AnimationId = 'rbxassetid://7721914253'
local playIdle = AnimControl:LoadAnimation(Idle)
local walk = Instance.new("Animation")
walk.AnimationId = 'rbxassetid://7722265754'
local playwalk = AnimControl:LoadAnimation(walk)
local reload = Instance.new("Animation")
reload.AnimationId = 'rbxassetid://7738232223'
local playreload = AnimControl:LoadAnimation(reload)
--local aimhold = Instance.new("Animation")
--aimhold.AnimationId = 'rbxassetid://7715900268'
--local aimplayhold = AnimControl:LoadAnimation(aimhold)
local function stripperclip()
local clip = game.ReplicatedStorage.weapons.Ammunition.SKS10RoundStripperClip:Clone()
clip.Parent = game.Workspace
local RightHand = ViewModel:WaitForChild("RightLowerArm")
if RightHand then
print("Found")
clip:SetPrimaryPartCFrame(RightHand.CFrame)
local weld = Instance.new("WeldConstraint")
weld.Parent = RightHand
weld.Part0 = RightHand
weld.Part1 = clip.Clip
end
end
UIS.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
if Input.KeyCode == Enum.KeyCode.R then
playreload:Play(0.4)
-- stripperclip()
wait(3.5)
if movementstatus == false then
playIdle:Play()
else
playwalk:Play()
end
end
end)
--aiming
hum.Running:Connect(function(speed)
if speed > 0 then
movementstatus = true
playwalk:Play()
else
movementstatus = false
playIdle:Play()
playwalk:Stop()
end
end)
RunService.RenderStepped:Connect(function(dl)
ViewModel:SetPrimaryPartCFrame(Camera.CFrame)
end)
some of the code in this script is not relevant, but the majority of the problem I believe resides in the animation playing and stopping section of the script