So I am currently trying to push the player back when they get his but its only pushing the player back on the z axis. How could I make it push you the direction that the other player is looking? (I am not that good with CFrame or lookVectors)
local debounce = false
script.Parent.Touched:Connect(function(hit)
local Hit_Character = hit.Parent:FindFirstChild("Humanoid").Parent or hit.Parent.Parent:FindFirstChild("Humanoid").Parent
if debounce == false then
debounce = true
local bv = Instance.new("BodyVelocity")
local offset = Vector3.new()
bv.Parent = (Hit_Character.Torso)
bv.MaxForce = Vector3.new(10000000,10000000,10000000) -- This can be identified as the power
bv.Velocity = Vector3.new(0, 50, 100)
wait(0.01)
bv:Destroy()
end
wait(1)
debounce = false
end)
local debounce = false
script.Parent.Touched:Connect(function(hit)
local Hit_Character = hit.Parent:FindFirstChild("Humanoid").Parent or hit.Parent.Parent:FindFirstChild("Humanoid").Parent
if debounce == false then
debounce = true
local bv = Instance.new("BodyVelocity")
local offset = Vector3.new()
bv.Parent = (Hit_Character.Torso)
bv.MaxForce = Vector3.new(10000000,10000000,10000000) -- This can be identified as the power
bv.Velocity = Hit_Character.Head.CFrame.LookVector * -50
wait(0.01)
bv:Destroy()
end
wait(1)
debounce = false
end)
Try this. -50 is the velocity that will be applied.
Try this. Now I am adding an UpVector that is multiplied by 50.
local debounce = false
script.Parent.Touched:Connect(function(hit)
local Hit_Character = hit.Parent:FindFirstChild("Humanoid").Parent or hit.Parent.Parent:FindFirstChild("Humanoid").Parent
if debounce == false then
debounce = true
local bv = Instance.new("BodyVelocity")
local offset = Vector3.new()
bv.Parent = (Hit_Character.Torso)
bv.MaxForce = Vector3.new(10000000,10000000,10000000) -- This can be identified as the power
bv.Velocity = (Hit_Character.Head.CFrame.LookVector * -50) + (Hit_Character.Head.CFrame.UpVector * 50)
wait(0.01)
bv:Destroy()
end
wait(1)
debounce = false
end)