You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to knockback the actual players in game. -
What is the issue? Include screenshots / videos if possible!
https://gyazo.com/1df031198d94b25eef42628d7b56fb58
it only works on npc and not on players
3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Tried making it as serverscript but nothing works.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Down is my whole script but
local rp = game:GetService("ReplicatedStorage")
local remote = script.Parent.Punch
local tool = script.Parent.Parent
local damage = script:GetAttribute("Damage")
remote.OnServerEvent:Connect(function(player,target)
print(target)
if target:FindFirstChild("HumanoidRootPart") then
local root = target.HumanoidRootPart
target:FindFirstChild("Humanoid"):TakeDamage(10)
local fx = rp.Hit.Damaged:Clone()
local sfx = script.Parent.Hit:Clone()
local gfx = rp.Hit.HitEffect:Clone()
fx.Parent = target
sfx.Parent = target
gfx.Parent = root
gfx.Position = root.Position
sfx:Play()
local minimumForce = root.AssemblyMass * workspace.Gravity
local mass = root.AssemblyMass
local forceToApply = mass*70
local upforce = mass* 40
root:ApplyImpulse(player.Character.HumanoidRootPart.CFrame.LookVector*forceToApply +Vector3.new(0,upforce,0))
task.wait(0.25)
gfx:Destroy()
fx:Destroy()
sfx:Destroy()
end
end)
only this part is the ApplyImpulse()
local minimumForce = root.AssemblyMass * workspace.Gravity
local mass = root.AssemblyMass
local forceToApply = mass*70
local upforce = mass* 40
root:ApplyImpulse(player.Character.HumanoidRootPart.CFrame.LookVector*forceToApply +Vector3.new(0,upforce,0))