#I dont even know anymore
1 messages · Page 1 of 1 (latest)
Uppercase
youre not defining the animator
wdym
yeah cuz its under humanoid
ik
yeah
ik I just did that
it should be able to find the animator now
how would I make it play an animation
animator:LoadAnimation(animation):Play()
"animation" is underlined red, what do I do?
Show the whole script
local stanceAnimation = ReplicatedStorage:WaitForChild("Anims"):WaitForChild("StanceAnim")
local stanceTracks = {}
stanceHeld.OnServerEvent:Connect(function(player)
local character = player.Character
if not character then return end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then return end
local animator = humanoid:FindFirstChildOfClass("Animator")
if animator and stanceAnimation then
local track = animator:LoadAnimation(stanceAnimation)
track:Play()
track.Looped = true
stanceTracks[player] = track
end
end)
example
local track = animator:LoadAnimation(YOUR ANIM VARIABLE)
track:Play()
to stop it
use
track:Stop()
you must define animation as a variable
otherwise the script wont actually know what "animation" is
** You are now Level 12! **
sorry for not replying
** You are now Level 6! **
what do I define "animation" to be
local UserInputService = game:GetService("UserInputService")
local animation = ("UwalkAnim")
local function onInputStarted(inputObject, processedEvent)
if processedEvent then return end
if inputObject.KeyCode == Enum.KeyCode.LeftShift then
local character = Players.LocalPlayer.Character
if not character then return end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then return end
local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator then return end
humanoid.WalkSpeed = 30
animator:LoadAnimation(animation):Play(133873410833807)
end
end
local function onInputEnded(inputObject, processedEvent)
if processedEvent then return end
if inputObject.KeyCode == Enum.KeyCode.LeftShift then
local character = Players.LocalPlayer.Character
if not character then return end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then return end
local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator then return end
humanoid.WalkSpeed = 16
end
end
UserInputService.InputBegan:Connect(onInputStarted)
UserInputService.InputEnded:Connect(onInputEnded)```