So basicaly I made a combat script that contacts the server to play an animation on a player when activated. But when I click nothing happens I reviewed the script there are no errors, even output shows nothing. It just doesnt work.
LocalScript:
wait(1.5)
local tool = script.Parent
local player = game:GetService'Players'.LocalPlayer
local char = player.Character
local hum = char:findFirstChild("Humanoid")
local model = tool.anims
local UIS = game:GetService('UserInputService')
local on = 1
local en = true
local ten = true
local weld = Instance.new("Weld")
local weld2 = Instance.new("Weld")
local LeftArm = char:findFirstChild("Left Arm")
local RightArm = char:findFirstChild("Right Arm")
local swinging = false
local seconds = 0.5
local cooldown = 0
local torso = char.Torso
local blocks = false
local damage = 5
local hitbox = game.Workspace:WaitForChild("Hitbox",10000000)
tool.Equipped:Connect(function(mouse)
script.Equipped:FireServer()
mouse.Button1Down:Connect(function(attack)
script.Attack:FireServer()
end)
end)
hitbox.Touched:Connect(function(touching)
script.Touched:FireServer()
end)
ServerScript:
wait(1.5)
local tool = script.Parent.Parent
local model = tool.anims
local UIS = game:GetService('UserInputService')
local on = 1
local en = true
local ten = true
local swinging = false
local seconds = 0.5
local cooldown = 0
local blocks = false
local damage = 5
local hitbox = game.Workspace:WaitForChild("Hitbox",10000000)
script.Parent.Equipped.OnSererEvent:Connect(function(plr)
local char = game.Workspace:FindFirstChild(plr.Name)
local hum = char.Humanoid
local torso = char.Torso
local hitbox = game.ReplicatedStorage.Hitbox:Clone()
hitbox.Parent = workspace
local weld = Instance.new("Weld")
weld.Parent = hitbox
weld.Part0 = torso
weld.Part1 = hitbox
weld.C0 = CFrame.new(0,0,1)
end)
script.Parent.Attack.OnServerEvent:Connect(function(plr)
local char = game.Workspace:FindFirstChild(plr.Name)
local hum = char.Humanoid
if blocks == true then return end
if cooldown == 1 then return end
if en == false then return end
en = false
local anim = hum:LoadAnimation(tool.anims ["Animation"..on])
anim:Play()
ten = true
swinging = true
wait(seconds)
en = true
swinging = false
on = on + 1
if on > 4 then
cooldown = 1
on = 1
wait(2)
cooldown = 0
end
end)
script.Parent.Touched.OnServerEvent:Connect(function(plr)
local char = game.Workspace:FindFirstChild(plr.Name)
local hum = char.Humanoid
if not swinging then return end
if ten == false then return end
hitbox.Touched:Connect(function(Player)
local opponent = Player.Parent.Humanoid
local stun = opponent:LoadAnimation(tool.stuns ["Animation"..on])
if Player and swinging == true then
if Player.Parent:FindFirstChild("block") then return end
ten = false
stun:Play()
opponent:TakeDamage(damage)
end
end)
end)

1 comment
please indent your code