Well, i’m making a sword game soooo
-- // Variable
local cache = {}
-- // Modules
local RaycastHitbox = require(game.ReplicatedStorage.RaycastHitbox)
-- // Main Script
game.ReplicatedStorage.Attack.OnServerEvent:Connect(function(executor, arg) -- Get the event
-- // Variables
local tool = executor.Character:FindFirstChildOfClass("Tool")
local Track = cache[executor.UserId]
local count, isdebounce = executor.Temp.Count, executor.Temp.IsDebounce
if not Track and arg == "M1" and count.Value == 0 and isdebounce.Value == false then
local hitbox = RaycastHitbox:Initialize(tool.Hitbox, {executor.Character})
cache[executor.UserId.." M1"] = executor.Character.Humanoid.Animator:LoadAnimation(tool.Config.slash1)
cache[executor.UserId.." M1"]:Play()
hitbox:HitStart(cache[executor.UserId.." M1"].Length - 0.1)
local temp = hitbox.OnHit:Connect(function(hit, humanoid)
print(hit)
humanoid:TakeDamage(10)
end)
elseif not Track and arg == "M2" then
-- // Do block
end
end)
Yes the script is server sided