Server Script:
--[ Variables local Tool = script.Parent local Player = game.Players:GetPlayerFromCharacter(Tool.Parent) local Remote = script.Parent.Remote local Swinging = false local SwingAnim = "http://www.roblox.com/Asset?ID=1450972333" local Char = Player.Character or Player.CharacterAdded:Wait() local Hum = Char:WaitForChild("Humanoid") local CanDamage = true --[ Functions function Hit(hit) if hit.Parent:FindFirstChild("Humanoid") then if hit.Parent.Name == "Core" then if hit.Parent.Parent.TeamColor.Value ~= Player.TeamColor then if Swinging then hit.Parent.Humanoid:TakeDamage(script.Parent.Configurations.SwingDamage.Value) CanDamage = false wait(1) CanDamage = true elseif not Swinging then hit.Parent.Humanoid:TakeDamage(script.Parent.Configurations.NoSwingDamage.Value) CanDamage = false wait(1) CanDamage = true end end elseif game.Players:GetPlayerFromCharacter(hit.Parent) then if Swinging then hit.Parent.Humanoid:TakeDamage(script.Parent.Configurations.SwingDamage.Value) CanDamage = false wait(1) CanDamage = true else hit.Parent.Humanoid:TakeDamage(script.Parent.Configurations.NoSwingDamage.Value) CanDamage = false wait(1) CanDamage = true end end end end function Swing() Swinging = true local Anim = Instance.new("Animation") Anim.AnimationId = SwingAnim local AnimTrack = Hum:LoadAnimation(Anim) AnimTrack:Play() wait(1.2) Swinging = false end Remote.OnServerEvent:Connect(function(p,key,k) if key == "Swing" then Swing() end if key == "Hit" then Hit(k) end end)
local script:
--[ Variables local Player = game.Players.LocalPlayer local Tool = script.Parent local Remote = script.Parent.Remote Tool.Activated:Connect(function() Remote:FireServer("Swing") end) Tool.Handle.Touched:Connect(function(h) Remote:FireServer("Hit",h) end)
For one, animations are called from local script. You don't have to use a remote event for that. For number two, their is no part in the Roblox character called 'core'. It's called 'HumanoidRootPart'. Use that instead.