local Player = game.Players.LocalPlayer
local Character = Player.Character
local UIS = game:GetService('UserInputService')
local Players = game:GetService("Players")
local humanoid, char, player, rootPart, mouse, cam = nil, nil, nil, nil, nil, workspace.CurrentCamera
local anims = {}
local currentAnim = nil
--idle anim
script.Parent.Equipped:Connect(function()
humanoid = script.Parent.Parent.Humanoid
player= game.Players:GetPlayerFromCharacter(script.Parent.Parent)
char = script.Parent.Parent
rootPart= humanoid.RootPart
mouse= player:GetMouse()
anims.idle = humanoid:LoadAnimation(script.IdleAnim)
currentAnim = anims.idle
currentAnim:Play()
end)
--walk anim
script.Parent.Unequipped:Connect(function()
if currentAnim then
currentAnim:Stop()
currentAnim = nil
end
end)
UIS.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.W and script.Parent.Parent == Player then
Character.Humanoid.WalkSpeed = 8
Character.Humanoid.JumpHeight = 0
local Anim = Instance.new('Animation')
Anim.AnimationId = 'rbxassetid://98737670948083'
PlayAnim = Character.Humanoid:LoadAnimation(Anim)
PlayAnim:Play()
else
task.wait()
end
end)
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.W then
Character.Humanoid.WalkSpeed = 16
Character.Humanoid.JumpHeight = 7.2
local Anim = Instance.new('Animation')
Anim.AnimationId = 'rbxassetid://98737670948083'
PlayAnim = Character.Humanoid:LoadAnimation(Anim)
PlayAnim:Stop()
end
end)
** You are now Level 6! **