So hey! how do i make a LocalScript that all people can use when i press X i will do the Animation? Animation name is ExportAnim
Thanks for all Anwsers that are comming :)
So what you have to do it the following ~Make your keydown function
function onKeyDown(key) local Key = key:lower() if key == "r" then -- (this is a localscript in the startergui by the way) end end
Next what you want to do is to define your animations
local SprintAnim = Instance.new("Animation") SprintAnim.AnimationId = "rbxassetid://425082298" -- Or whatever your animation is
Then when you want to play that animation you do this
mouse = Player:GetMouse() -- Get players Mouse Player = game.Players.LocalPlayer Character = Player.Character or Player.CharacterAdded:wait() Humanoid = Character:WaitForChild('Humanoid') local animationTrack = Humanoid:LoadAnimation(SprintAnim) animationTrack:Play()
Now we put it together, your results are...
Player = game.Players.LocalPlayer Character = Player.Character or Player.CharacterAdded:wait() Humanoid = Character:WaitForChild('Humanoid') local SprintAnim = Instance.new("Animation") SprintAnim.AnimationId = "rbxassetid://425082298" -- Or whatever your animation is function onKeyDown(key) local Key = key:lower() if key == "r" then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16 * 2.5 local animationTrack = Humanoid:LoadAnimation(SprintAnim) animationTrack:Play() end end mouse.KeyDown:connect(onKeyDown) -- Call the function c:
HOPE THIS HELPED :D