I want to a player get flinged upon death on R6. (I have already a ragdoll ready) the only thing left if that when they die they get flinged far away.
I have found this script upon searching online which seems to fit what i was looking for, but no luck after all, it doesn’t work. I tried putting it on ServerScriptService and StarterPlayerScripts and StarterChracterScripts, also its a server script.
game.Players.PlayerAdded:Connect(
function(plr)
plr.CharacterAdded:Connect(
function(Character)
local Humanoid = Character:FindFirstChild("Humanoid") -- Humanoid
if Humanoid.Health = 0 then -- If the player is dead
local BodyVelocity = Instance.new("BodyVelocity") -- Creates a new BodyVelocity force inside Character
BodyVelocity.Parent = Character
BodyVelocity.Velocity = Vector3.new(0, 200, 0) -- Sets velocity, you can change this up depending on what direction you want the player to go to in.
wait(1)
BodyVelocity:Destroy() -- Deletes the force, making the player start to come back down.
end
end
)
end
)
I believe you’ll have to put this in a loop since it’s only checking if the player’s health is at 0 when they join the game. Do what the person under me is saying, actually.
Lastly, you set the BodyVelocity’s parent to the character, where a BodyVelocity is only useful whenever it is a child of a BasePart instance. Therefore, I changed the code so that it places it within the HumanoidRootPart instead.
Actually, the script that Jackscarlett made IS working, but the issue is that the BodyVelocity is only being applied to the HumanoidRootPart. If you’d like to make the character actually get flinged when they die, the best thing to do would be to apply the BodyVelocity to ALL of the parts inside of the character, and not only the HumanoidRootPart.