I’m currently working on a sword. How should I set up the code?
Should I use animations and debounce on the client and send a remote event to the server?
like this:
Client:
local Debounce = true
sword.Touched:connect(function(hit)
if player then
if Debounce == true then
Debounce = false
RemoteEvent:FireServer(player, sword)
wait(1)
Debounce = true
end
end
end)
Server:
RemoteEvent.OnClientEvent:connect(function(player, Attackedplayer, sword)
local Damage = game.ReplicatedStorage.SwordValues:FindFirstChild(sword).Value
Attackedplayer:Damage(Damage)
end)
How could I be sure exploiters can’t exploit with the sword?
You should handle debounces, hitbox, and damage all on the server. Treat the remote event to the server like a request from the client to the server. (Client asking the server if they can use the sword) Handle animations on the client as it automatically replicates.
I will use this, thank you! Do you think I should rather use the Making a Deadly Part (The Easy/Lazy Way) or Making a Deadly Part (Intermediate Way) Tutorial??