Hello, i try to make a Annimation for Crawling, but the annimation wont load.
Can someone help me?
(Idk for what Category this question are, Sry)
Hello, i try to make a Annimation for Crawling, but the annimation wont load.
Can someone help me?
(Idk for what Category this question are, Sry)
Please could you provide a sample of code? Cannot help you otherwise.
i have the Code out of a Youtube Video so idk but it should work, so all works, the speed is slower but the annimation is not playing
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local AnimationID = "15411945306"
local CameraOffsetOn = Vector3.new(0, 0, 0)
local CameraOffsetOff = Vector3.new(0, 0, 0)
local WalkSpeedCrouched = 5--ADJUST CROUCH SPEED HERE
local WalkSpeedStanding = 14 -- IF you using a SHIFT SPRINT or any other script, make sure walk speeds match up!!
local PlaybackSpeedCrouched = 0.70
local PlaybackSpeedStanding = 1
local Animation = Instance.new("Animation")
Animation.AnimationId = "https://www.roblox.com/asset/?id=124369778984149" .. AnimationID
local CrouchAnimation = Humanoid:LoadAnimation(Animation)
local function setCrouchState(isCrouching)
if isCrouching then
Humanoid.WalkSpeed = WalkSpeedCrouched
TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOn }):Play()
Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedCrouched
Character.HumanoidRootPart.CanCollide = false
CrouchAnimation:Play()
while wait() do
if Humanoid.MoveDirection.Magnitude > 0 then
CrouchAnimation:AdjustSpeed(1)
else
CrouchAnimation:AdjustSpeed(0)
end
end
else
Humanoid.WalkSpeed = WalkSpeedStanding
TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOff }):Play()
Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedStanding
Character.HumanoidRootPart.CanCollide = true
CrouchAnimation:Stop()
end
end
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.LeftControl or input.KeyCode == Enum.KeyCode.C then --buttons to crouch HERE ( make sure to change it on line 55 too)
setCrouchState(true)
end
end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.LeftControl or input.KeyCode == Enum.KeyCode.C then -- buttons (make sure they match to the line above^^)
setCrouchState(false)
end
end
end)
Is the crawling animation made by someone else or made by you? If it was made by someone else, you may not have permission to use the animation therefore giving you that error. Also you were adding on another animation ID onto another one and I cleaned it up so I could read it more easily:
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local AnimationID = "15411945306" -- INPUT YOUR ANIMATION ID HERE
local CameraOffsetOn = Vector3.new(0, 0, 0)
local CameraOffsetOff = Vector3.new(0, 0, 0)
local WalkSpeedCrouched = 5 --ADJUST CROUCH SPEED HERE
local WalkSpeedStanding = 14 -- IF you using a SHIFT SPRINT or any other script, make sure walk speeds match up!!
local PlaybackSpeedCrouched = 0.70
local PlaybackSpeedStanding = 1
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://" .. AnimationID
local CrouchAnimation = Humanoid:LoadAnimation(Animation)
local function setCrouchState(isCrouching)
if isCrouching then
Humanoid.WalkSpeed = WalkSpeedCrouched
TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOn }):Play()
Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedCrouched
Character.HumanoidRootPart.CanCollide = false
CrouchAnimation:Play()
while wait() do
if Humanoid.MoveDirection.Magnitude > 0 then
CrouchAnimation:AdjustSpeed(1)
else
CrouchAnimation:AdjustSpeed(0)
end
end
else
Humanoid.WalkSpeed = WalkSpeedStanding
TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOff }):Play()
Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedStanding
Character.HumanoidRootPart.CanCollide = true
CrouchAnimation:Stop()
end
end
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.LeftControl or input.KeyCode == Enum.KeyCode.C then --buttons to crouch HERE ( make sure to change it on line 55 too)
setCrouchState(true)
end
end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.LeftControl or input.KeyCode == Enum.KeyCode.C then -- buttons (make sure they match to the line above^^)
setCrouchState(false)
end
end
end)
The annimation is made by me, thats why im so confused. i try find a solution but could finde one
by the Second read of your reply i had check what you saying, Thank You for helping me
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.