So my knockback knocks the player forward and ragdolls them but they then tp back to where they were normally.
Vid:
Script:
local Damage = Info["Damage"]
local MousePos = Info["MousePos"]
if character:FindFirstChild("EnergyBall") then
local EnergyBall = character:FindFirstChild("EnergyBall")
wait(.5)
if RightHand:FindFirstChild("EnergyBallWeld") then
RightHand:FindFirstChild("EnergyBallWeld"):Destroy()
else
error("Attempt to index nil with Energy ball weld")
end
EnergyBall.CFrame = CFrame.new(HumanoidRootPart.Position,MousePos)
local BV = Instance.new("BodyVelocity",EnergyBall)
BV.Velocity = EnergyBall.CFrame.lookVector * 100
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
game:GetService("Debris"):AddItem(BV,.25)
EnergyBall.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent.Name ~= player.Name then
Hit.Parent:FindFirstChild("Humanoid").BreakJointsOnDeath = false
Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(Damage)
EnergyBall:Destroy()
if Hit.Parent:FindFirstChild("Humanoid").Health == 0 then return end
local HRP = Hit.Parent:FindFirstChild("HumanoidRootPart")
HRP.Velocity = HRP.CFrame.LookVector * 100 + Vector3.new(0,50,0)
for _, part in pairs(Hit.Parent:GetDescendants()) do
if part:IsA("Motor6D") then
local Attach0 = Instance.new("Attachment",part.Part0)
local Attach1 = Instance.new("Attachment",part.Part1)
Attach0.Name = "Attach0"
Attach1.Name = "Attach1"
Attach0.CFrame = part.C0
Attach1.CFrame = part.C1
local Hinge = Instance.new("BallSocketConstraint",part.Part0)
Hinge.Attachment0 = Attach0
Hinge.Attachment1 = Attach1
part:Destroy()
end
end
wait(1.5)
for _, v in pairs(Hit.Parent:GetDescendants()) do
if v.Name == "Attach0" or v.Name == "Attach1" or v:IsA("BallSocketConstraint") then
v:Destroy()
end
end
Hit.Parent:FindFirstChild("Humanoid"):BuildRigFromAttachments()
Hit.Parent:FindFirstChild("Humanoid"):ChangeState("Ragdoll")
end
end)
print("Done")
I want the thing my spell attacks ragdoll them and give them knockback. You see in the vid they tp and I don’t want that to happen. I want them to also get up after the ragdoll.
I had a thought that the dummy’s HRP is anchored, well I was wrong
for the BodyVelocity, I’m assuming this is inside the “part.Hit” function. You should add the character’s HRP and the enemy’s HRP, here’s an example:
local enemyHrp = Hit.Parent:WaitForChild("HumanoidRootPart")
local yourHrp = character:WaitForChild("HumanoidRootPart")
local Knockback = Instance.new("BodyVelocity", enemyHrp)
Knockback.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
Knockback.Velocity = yourHrp.CFrame.LookVector * 5 -- yourHrp is the player who shoots the fireball thingy
task.wait()
Knockback:Destroy()
Well really doesn’t change anything on the effect I just want it to be the exact same as the vid or very simular. I feel like the ragdoll part is the problem. How would I make the player’s character affected fling like in the vid.
Hey, @vendinY I am having issues again with knock back. This time it doesn’t even give knockback!
Vid:
Script:
game.ReplicatedStorage.TelekeneticPushEvent.OnServerEvent:Connect(function(player,mousePos)
local character = player.Character or player.CharacterAdded:Wait()
local HumanoidRootPart = character:WaitForChild("HumanoidRootPart")
local Origin = character.PrimaryPart.Position
local Direction = (mousePos - Origin).Unit * 50
local Params = RaycastParams.new()
Params.FilterDescendantsInstances = {character}
Params.FilterType = Enum.RaycastFilterType.Blacklist
local rayCast = workspace:Raycast(Origin,Direction,Params)
if rayCast then
local InstanceFound = rayCast.Instance
if InstanceFound then
if InstanceFound.Parent:FindFirstChild("Humanoid") then
local Knockback = Instance.new("BodyVelocity")
Knockback.Parent = InstanceFound.Parent:FindFirstChild("HumanoidRootPart")
Knockback.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
Knockback.Velocity = (HumanoidRootPart.CFrame.LookVector * 50) + Vector3.new(0, 25, 0)
game:GetService("Debris"):AddItem(Knockback, 0.1)
game.ReplicatedStorage.TelekeneticPushCD:FireClient(player)
end
end
end
end)
I checked and it gets put in the dummies humanoid root part. I also checked if it was anchored or not the dummy was not anchored, I will now try spawning a default new dummy