Making a baseball bat with knockout system

Hello everyone!

  1. What do you want to achieve?
    So there will be a baseball bat (as a tool) and when It hits a person, It will knockout the person that It hit and make the person go ragdoll, after 5 seconds the person will get back up.
  2. What is the issue?
    I don’t really know how to do It
  3. What solutions have you tried so far?
    I searched for topics like this on the forum but I couldn’t find any.
1 Like

Well for starters, you could have a bat tool with a swing animation that plays whenever the tool is activated. Then, just use touched events to see if it hit a player. Here is an example:

bat.Touched:Connect(function(hit)
   if hit.Parent:FindFirstChild("Humanoid") then
      -- run code to ragdoll them, then have them get up.
   end
end)

But that means If anyone touches the bat they will get ragdolled even If the weapon Isn’t activated

You would have to script some checks to see if it is activated. Like this:

local active = false

tool.Activated:Connect(function()
   if not active then
       active = true
       wait(1)
       active = false
   end
end
bat.Touched:Connect(function(hit)
   if hit.Parent:FindFirstChild("Humanoid") then
     if active then
 -- run code to ragdoll them, then have them get up.
     end
   end
end)
2 Likes