Im not sure if this type of question is ok, but I really have no clue on how to do this. Basically, im trying to make an ability for a sword when you press e, it knocks the opponent in front back. But I don't really know how to do this. I would REALLY appreciate help.
here is the script in server script service, which gets activated when the remote gets fired from the sword:
game.ReplicatedStorage.Bat.OnServerEvent:Connect(function(player)
local char = player.Character
local bat = char:FindFirstChild("Bat")
wait(1.2)
bat.Handle.Bonk:Play()
bat.Handle.bat_hit:Play()
bat.Handle.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Name ~= player.Name then
hit.Parent.Humanoid:TakeDamage(3)
end
end
end)
end

4 comments
Also, remove your original LocalScript or else it may cause an error.
Thanks! I already did have a local script inside of the actual tool, not the handle and I made it fire an event to activate it, but i'll try the other script you sent! Thanks again!
It works!! Thank you SO MUCH man. I really needed an answer for this because i just couldnt figure out why it would do this. I really apprecicated the help. Thank you!
Your welcome!