I have a sword script. Though i keep getting errors, eof or I have too many ends. So I delete the end it says that is giving an error message than tells me to put the end back in a different error message. I keep tinkering with it and nothing is working. Its just giving me the same dang error message!!!
local script:
local wind = Instance.new("Part", workspace)
wind.Shape = "Cylinder"
wind.Size = Vector3.new(0.7,30.1,74.3)
wind.BrickColor = BrickColor.new("Ghost grey")
wind.Anchored = true
wind.CanCollide = false
wind.Transparency = 1
wind.Material = "SmoothPlastic"
local Info = TweenInfo.new(2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,true,0)
local flash = game:GetService("TweenService"):Create(wind,Info,{Size = Vector3.new(1,100,100)})
local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local InputService = game:GetService("UserInputService")
local InputType = Enum.UserInputType
local animation = nil
local slashAnimation = nil
local swing1 = nil
local wham1 = nil
tool.Equipped:Connect(function()
animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7118111810"
slashAnimation = humanoid:LoadAnimation(animation)
swing1 = Instance.new("Animation")
swing1.AnimationId = "rbxassetid://7193950823"
wham1 = humanoid:WaitForChild("Animator"):LoadAnimation(swing1)
end)
tool.Unequipped:Connect(function()
animation:Destroy()
slashAnimation = nil
swing1:Destroy()
wham1 = nil
end)
local hi = character:WaitForChild("HumanoidRootPart")
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(key)
if key.UserInputType == Enum.UserInputType.MouseButton3 then
wham1:Play()
wait(1)
local playpos = CFrame.new(hi.Position)
wind.CFrame = playpos
local rotate = CFrame.Angles(0, math.rad(0), math.rad(90))
wind.CFrame = wind.CFrame:ToWorldSpace(rotate)
wind.Transparency = 0.25
flash:Play()
wind.Touched:Connect(function(partOther)
local humanOther = partOther.Parent:FindFirstChild("Humanoid")
if humanOther and humanOther.Parent ~= tool.Parent then
game.ReplicatedStorage.RemoteEvent:FireServer(humanOther)
end
end)
local debounce = false
InputService.InputBegan:Connect(function(input, processed)
if input.UserInputType == InputType.MouseButton1 and slashAnimation and not processed then
if debounce then return end
debounce = true
slashAnimation:Play()
local Connection
local tool = script.Parent
local function onTouch(partOther)
local humanOther = partOther.Parent:FindFirstChild("Humanoid")
if not humanOther then return end
if humanOther.Parent == tool then return end
humanOther:TakeDamage(20)
end
Connection = tool:WaitForChild("Handle").Touched:Connect(onTouch)
slashAnimation.Stopped:Wait()
debounce = false
Connection:Disconnect()
end
end
local wind = Instance.new("Part", workspace)
wind.Shape = "Cylinder"
wind.Size = Vector3.new(0.7,30.1,74.3)
wind.BrickColor = BrickColor.new("Ghost grey")
wind.Anchored = true
wind.CanCollide = false
wind.Transparency = 1
wind.Material = "SmoothPlastic"
local Info = TweenInfo.new(2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,true,0)
local flash = game:GetService("TweenService"):Create(wind,Info,{Size = Vector3.new(1,100,100)})
local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local InputService = game:GetService("UserInputService")
local InputType = Enum.UserInputType
local animation = nil
local slashAnimation = nil
local swing1 = nil
local wham1 = nil
tool.Equipped:Connect(function()
animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7118111810"
slashAnimation = humanoid:LoadAnimation(animation)
swing1 = Instance.new("Animation")
swing1.AnimationId = "rbxassetid://7193950823"
wham1 = humanoid:WaitForChild("Animator"):LoadAnimation(swing1)
end)
tool.Unequipped:Connect(function()
animation:Destroy()
slashAnimation = nil
swing1:Destroy()
wham1 = nil
end)
local hi = character:WaitForChild("HumanoidRootPart")
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(key)
if key.UserInputType == Enum.UserInputType.MouseButton3 then
wham1:Play()
wait(1)
local playpos = CFrame.new(hi.Position)
wind.CFrame = playpos
local rotate = CFrame.Angles(0, math.rad(0), math.rad(90))
wind.CFrame = wind.CFrame:ToWorldSpace(rotate)
wind.Transparency = 0.25
flash:Play()
wind.Touched:Connect(function(partOther)
local humanOther = partOther.Parent:FindFirstChild("Humanoid")
if humanOther and humanOther.Parent ~= tool.Parent then
game.ReplicatedStorage.RemoteEvent:FireServer(humanOther)
end
end)
end
end)
local debounce = false
InputService.InputBegan:Connect(function(input, processed)
if input.UserInputType == InputType.MouseButton1 and slashAnimation and not processed then
if debounce then return end
debounce = true
slashAnimation:Play()
local Connection
local tool = script.Parent
local function onTouch(partOther)
local humanOther = partOther.Parent:FindFirstChild("Humanoid")
if not humanOther then return end
if humanOther.Parent == tool then return end
humanOther:TakeDamage(20)
end
end
end)
Connection = tool:WaitForChild("Handle").Touched:Connect(onTouch)
slashAnimation.Stopped:Wait()
debounce = false
Connection:Disconnect()
end) --[[IF THIS DOESN'T WORK ON THIS LINE, ERASE THE PARENTHASIS.]]--
if key.UserInputType == Enum.UserInputType.MouseButton3 then
wham1:Play()
wait(1)
local playpos = CFrame.new(hi.Position)
wind.CFrame = playpos
local rotate = CFrame.Angles(0, math.rad(0), math.rad(90))
wind.CFrame = wind.CFrame:ToWorldSpace(rotate)
wind.Transparency = 0.25
flash:Play()
wind.Touched:Connect(function(partOther)
local humanOther = partOther.Parent:FindFirstChild("Humanoid")
if humanOther and humanOther.Parent ~= tool.Parent then
game.ReplicatedStorage.RemoteEvent:FireServer(humanOther)
end
end)
end
local wind = Instance.new("Part", workspace)
wind.Shape = "Cylinder"
wind.Size = Vector3.new(0.7,30.1,74.3)
wind.BrickColor = BrickColor.new("Ghost grey")
wind.Anchored = true
wind.CanCollide = false
wind.Transparency = 1
wind.Material = "SmoothPlastic"
local Info = TweenInfo.new(2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,true,0)
local flash = game:GetService("TweenService"):Create(wind,Info,{Size = Vector3.new(1,100,100)})
local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local InputService = game:GetService("UserInputService")
local InputType = Enum.UserInputType
local animation = nil
local slashAnimation = nil
local swing1 = nil
local wham1 = nil
tool.Equipped:Connect(function()
animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7118111810"
slashAnimation = humanoid:LoadAnimation(animation)
swing1 = Instance.new("Animation")
swing1.AnimationId = "rbxassetid://7193950823"
wham1 = humanoid:WaitForChild("Animator"):LoadAnimation(swing1)
end)
tool.Unequipped:Connect(function()
animation:Destroy()
slashAnimation = nil
swing1:Destroy()
wham1 = nil
end)
local hi = character:WaitForChild("HumanoidRootPart")
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(key)
if key.UserInputType == Enum.UserInputType.MouseButton3 then
wham1:Play()
wait(1)
local playpos = CFrame.new(hi.Position)
wind.CFrame = playpos
local rotate = CFrame.Angles(0, math.rad(0), math.rad(90))
wind.CFrame = wind.CFrame:ToWorldSpace(rotate)
wind.Transparency = 0.25
flash:Play()
wind.Touched:Connect(function(partOther)
local humanOther = partOther.Parent:FindFirstChild("Humanoid")
if humanOther and humanOther.Parent ~= tool.Parent then
game.ReplicatedStorage.RemoteEvent:FireServer(humanOther)
end
end)
end
end)
local debounce = false
InputService.InputBegan:Connect(function(input, processed)
if input.UserInputType == InputType.MouseButton1 and slashAnimation and not processed then
if debounce then return end
debounce = true
slashAnimation:Play()
local Connection
local tool = script.Parent
local function onTouch(partOther)
local humanOther = partOther.Parent:FindFirstChild("Humanoid")
if not humanOther then return end
if humanOther.Parent == tool then return end
humanOther:TakeDamage(20)
end-- the missing end for onTouch function
end
end
end)
Connection = tool:WaitForChild("Handle").Touched:Connect(function(hit)
slashAnimation.Stopped:Wait()
debounce = false
Connection:Disconnect()
end) --[[IF THIS DOESN'T WORK ON THIS LINE, ERASE THE PARENTHASIS.]]--
Firstly, itās not connecting to a function, so why is there shouldnāt be an end after it (so delete the last end). Secondly, itās referencing a local function called within another function, so when run, it will be unfamiliar with what onTouch is.
local wind = Instance.new("Part", workspace)
wind.Shape = "Cylinder"
wind.Size = Vector3.new(0.7,30.1,74.3)
wind.BrickColor = BrickColor.new("Ghost grey")
wind.Anchored = true
wind.CanCollide = false
wind.Transparency = 1
wind.Material = "SmoothPlastic"
local Info = TweenInfo.new(2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,true,0)
local flash = game:GetService("TweenService"):Create(wind,Info,{Size = Vector3.new(1,100,100)})
local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local InputService = game:GetService("UserInputService")
local InputType = Enum.UserInputType
local animation = nil
local slashAnimation = nil
local swing1 = nil
local wham1 = nil
tool.Equipped:Connect(function()
animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7118111810"
slashAnimation = humanoid:LoadAnimation(animation)
swing1 = Instance.new("Animation")
swing1.AnimationId = "rbxassetid://7193950823"
wham1 = humanoid:WaitForChild("Animator"):LoadAnimation(swing1)
end)
tool.Unequipped:Connect(function()
animation:Destroy()
slashAnimation = nil
swing1:Destroy()
wham1 = nil
end)
local hi = character:WaitForChild("HumanoidRootPart")
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(key)
if key.UserInputType == Enum.UserInputType.MouseButton3 then
wham1:Play()
wait(1)
local playpos = CFrame.new(hi.Position)
wind.CFrame = playpos
local rotate = CFrame.Angles(0, 0, math.rad(90))
wind.CFrame = wind.CFrame:ToWorldSpace(rotate)
wind.Transparency = 0.25
flash:Play()
wind.Touched:Connect(function(partOther)
local humanOther = partOther.Parent:FindFirstChild("Humanoid")
if humanOther and humanOther.Parent ~= tool.Parent then
game.ReplicatedStorage.RemoteEvent:FireServer(humanOther)
end
end)
end
end)
local debounce = false
InputService.InputBegan:Connect(function(input, processed)
if input.UserInputType == InputType.MouseButton1 and slashAnimation and not processed then
if debounce then return end
debounce = true
slashAnimation:Play()
local Connection
local tool = script.Parent
local function onTouch(partOther)
local humanOther = partOther.Parent:FindFirstChild("Humanoid")
if not humanOther then return end
if humanOther.Parent == tool then return end
humanOther:TakeDamage(20)
end
Connection = tool:WaitForChild("Handle").Touched:Connect(onTouch)
slashAnimation.Stopped:Wait()
debounce = false
Connection:Disconnect()
end
end)