Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

So basically this should do punches. But it don't.Could someone please correct it?

Asked by 5 years ago

local player = game.Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()

local right = Instance.new("Animation")

local left = Instance.new("Animation")

right.AnimationId = "http://www.roblox.com/Asset?ID=2984842184"

left.AnimationId = "http://www.roblox.com/Asset?ID=2984913037"

enable = false

Mouse = game.Players.LocalPlayer:GetMouse()

enable = false

Mouse.KeyDown:Connect(function(Key)

if Key == "e" then

local anim = character:LoadAnimation(right)

if enable == false then

anim:Play()

wait(0.2)

else

print('test')

end

if Key =='q' then

local anim = character:LoadAnimation(left)

if enable == false then

anim:Play()

wait(0.2)

else

print('test')

end

end

end

end)

1 answer

Log in to vote
0
Answered by 5 years ago

I tested the script and here are the problems:

  • The quotation marks that you put are not the correct ones. It's this: ", not this “”.
  • You can load animations into the Humanoid of a character, not the character itself. So it's not character:LoadAnimation(left), but character:WaitForChild("Humanoid"):LoadAnimation(left).
  • Add an "elseif" instead of an "if" in Line 37 and remove the last end), then put a ) at the last end.

I hope I helped somehow.

Ad

Answer this question