Help im making a sword and im making a script that play the animation when you click.
Sword is directly connect to right arm by Motor6D
Output keep saying:
Workspace.[Player Name].AttackAnim:85: Expected 'end' (to close 'then' at line 41), got <eof>; did you forget to close 'then' at line 76?
Script:
local firstslash = game:GetService("KeyframeSequenceProvider"):RegisterKeyframeSequence(script:WaitForChild("SwordSlash1"))
local secondslash = game:GetService("KeyframeSequenceProvider"):RegisterKeyframeSequence(script:WaitForChild("SwordSlash2"))
local thirdslash = game:GetService("KeyframeSequenceProvider"):RegisterKeyframeSequence(script:WaitForChild("SwordSlash3"))
local fourthslash = game:GetService("KeyframeSequenceProvider"):RegisterKeyframeSequence(script:WaitForChild("SwordSlash4"))
local fifthslash = game:GetService("KeyframeSequenceProvider"):RegisterKeyframeSequence(script:WaitForChild("SwordSlash5"))
local firstslashanim = Instance.new("Animation")
firstslashanim.AnimationId = firstslash
local secondslashanim = Instance.new("Animation")
secondslashanim.AnimationId = secondslash
local thirdslashanim = Instance.new("Animation")
thirdslashanim.AnimationId = thirdslash
local fourthslashanim = Instance.new("Animation")
fourthslashanim.AnimationId = fourthslash
local fifthslashanim = Instance.new("Animation")
fifthslashanim.AnimationId = fifthslash
local Attackable = true
local Combo = 1
local Player = game:GetService("Players").LocalPlayer -- Gets the player
local Char = Player.Character or Player.CharacterAdded:Wait() -- Gets the players character
local UIS = game:GetService("UserInputService") -- Gets UserInputService
local RP = game:GetService("ReplicatedStorage")
local Slash1 = Char.Humanoid:LoadAnimation(firstslashanim)
local Slash2 = Char.Humanoid:LoadAnimation(secondslashanim)
local Slash3 = Char.Humanoid:LoadAnimation(thirdslashanim)
local Slash4 = Char.Humanoid:LoadAnimation(fourthslashanim)
local Slash5 = Char.Humanoid:LoadAnimation(fifthslashanim)
UIS.InputBegan:Connect(function(Input, gpe)
if not gpe then
if Input.UserInputType == Enum.UserInputType.MouseButton1 and Attackable == true and Combo == 1 then
Slash1:Play()
Attackable = false
wait(0.6)
Attackable = true
Combo = Combo + 1
print(Combo)
elseif Input.UserInputType == Enum.UserInputType.MouseButton1 and Attackable == true and Combo == 2 then
Slash2:Play()
Attackable = false
wait(0.6)
Attackable = true
Combo = Combo + 1
print(Combo)
elseif Input.UserInputType == Enum.UserInputType.MouseButton1 and Attackable == true and Combo == 3 then
Slash3:Play()
Attackable = false
wait(0.6)
Attackable = true
Combo = Combo + 1
print(Combo)
elseif Input.UserInputType == Enum.UserInputType.MouseButton1 and Attackable == true and Combo == 4 then
Slash4:Play()
Attackable = false
wait(0.6)
Attackable = true
Combo = Combo + 1
print(Combo)
elseif Input.UserInputType == Enum.UserInputType.MouseButton1 and Attackable == true and Combo == 5 then
Slash5:Play()
Attackable = false
wait(0.6)
Attackable = true
Combo = Combo - 5
print(Combo)
end
end
end)
Workspace:
–This is a modified version of a free model i picked up on toolbox–
–Im bad at scripting–