Hi, I'm trying to make a a bat in my game, and it's supposed to knock back players when its ability is used. For some reason, it only works on dummies and not actual players. Does anyone know why? Help would be appreciated.
here is the script in server script service:
bat.Handle.hitbox.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if hit.Parent.Name ~= player.Name then if debounce == false then debounce = true bat.Handle.BIGHIT:Play() game.ReplicatedStorage.Boom:FireAllClients() local boom1 = bat.Handle.hit1:Clone() local boom2 = bat.Handle.hit2:Clone() boom1.Parent = hit.Parent.HumanoidRootPart boom2.Parent = hit.Parent.HumanoidRootPart boom1.Enabled = true boom2.Enabled = true hit.Parent.HumanoidRootPart.Velocity = char.HumanoidRootPart.CFrame.LookVector * 300 + Vector3.new(0, 30, 0) hit.Parent.Humanoid:TakeDamage(20) wait(0.4) boom1.Enabled = false boom2.Enabled = false wait(1) boom1:Destroy() boom2:Destroy() end end end end) end)
DriBowser I finally finished the bat tool. Here is the model and I tested it for both players and NPCs.
It works well, but for the BIGHIT sound inside the handle, you must manually upload the sound effect and change the SoundId. The sound effect is here
Here is the game if you want to test it out first.