So I’ve been trying to make a simple script where the player can dive in the direction they are facing, much like egg hunt 2018. I have got the player character to move forward, but I can’t get the animation to play.
Here you can see my setup, including the script and the console. (The one that matters is “Animation is not a valid member of LocalScript”) The code is use is as follows:
local plr = game.Players.LocalPlayer
local Char = plr.Character or plr.CharacterAdded:Wait()
local UserInputService = game:GetService("UserInputService")
local Animation = script.Animation
local Humanoid = Char:WaitForChild("Humanoid")
local dash = Humanoid:LoadAnimation(Animation)
local Tapped = false
local Time = 1
UserInputService.InputBegan:Connect(function(Input, GameStuff)
if GameStuff then return end
if Input.KeyCode == Enum.KeyCode.LeftShift then
if not Tapped then
Tapped = true
Animation:Play()
Char.HumanoidRootPart.Velocity = Char.HumanoidRootPart.CFrame.lookVector*100
wait(Time)
Tapped = false
print("2")
else
print("1")
end
end
end)
Googling and browsing developer hub didn’t help me much. I have tried moving the animation in StarterCharacterScripts and getting it from there, but then it said that “Animation is not a valid member of Model”.
Any help is appreciated as I am totally clueless on how to proceed further.