RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make a combat system with a classic sword swing, block and a parry tell me where to put the code"
-- ServerScriptService local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(player) local sword = game.ServerStorage.Sword:Clone() sword.Parent = player.Backpack end) -- Sword Script (inside the sword model) local sword = script.Parent local debounce = false local blocking = false local parrying = false sword.Equipped:Connect(function(mouse) mouse.Button1Down:Connect(function() if not debounce then debounce = true sword.Handle:FindFirstChildWhichIsA("Animation"):Play() wait(0.5) debounce = false end end) mouse.Button2Down:Connect(function() if not debounce then debounce = true blocking = true sword.Handle:FindFirstChildWhichIsA("BlockAnimation"):Play() wait(0.5) debounce = false blocking = false end end) mouse.Button3Down:Connect(function() if not debounce and not blocking then debounce = true parrying = true sword.Handle:FindFirstChildWhichIsA("ParryAnimation"):Play() wait(0.5) debounce = false parrying = false end end) end) sword.Unequipped:Connect(function() sword.Handle:FindFirstChildWhichIsA("Animation"):Stop() sword.Handle:FindFirstChildWhichIsA("BlockAnimation"):Stop() sword.Handle:FindFirstChildWhichIsA("ParryAnimation"):Stop() end) -- You need to put the first script in ServerScriptService and the second script inside the sword model in ServerStorage. Also, make sure to replace "Animation", "BlockAnimation", and "ParryAnimation" with the actual names of your animations.