RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a swordscript for a sword tool"
-- local script local sword = script.Parent local attack = false sword.Equipped:Connect(function(mouse) while true do wait() if attack == true then local ray = Ray.new(sword.Handle.Position, (mouse.Hit.p - sword.Handle.Position).unit * 10) local part, position = workspace:FindPartOnRay(ray, sword.Parent, false, true) if part and part.Parent:FindFirstChild("Humanoid") then part.Parent.Humanoid:TakeDamage(5) end end end end) sword.Activated:Connect(function() attack = true end) sword.Deactivated:Connect(function() attack = false end)