Hi, I made a Animation script for a keydown function and for some reason the Title is what the output returned. Can you help me out please? Here's the script:
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() repeat wait() until Player.Character and Mouse Mouse.KeyDown:connect(function(Key) if Key == "q" then local Animation = Instance.new("Animation") Animation.AnimationId = "http://www.roblox.com/Asset?ID=281476213" local animTrack = Player.Character.Humanoid:LoadAnimation(Animation) animTrack:Play() end end)
Cheers for the help.
Alright, so your problem is that you referenced a variable to the player before it even existed. You can't reference something that doesn't exist yet and wait until it does exist. You have to do it the opposite way around.
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() -- The mouse should already exist since the player exists Mouse.KeyDown:connect(function(Key) if Key == "q" then local Animation = Instance.new("Animation") Animation.AnimationId = "http://www.roblox.com/Asset?ID=281476213" local animTrack = Player.Character.Humanoid:LoadAnimation(Animation) animTrack:Play() end end)