Fling part away from other

so i wanted to make one of those mines that fling you when you touch them and i did make it ragdoll you, but i cant make it fling you away from the mine.
Of course i made explosion object but i do not want to use it as blast object since i want to make an upgrade that will allow you to not get launched so far. basicly i want to make it fling you via body velocity so i can modify the velocity later on. is there a way to use trigonomety to calculate where to send the player?

3 Likes

Do you have a specific spot that you want the player to end up in?

you could use :ApplyImpulse on the HumanoidRootPart to fling the player away from the mine. u can then use the impulse parameter to define how strong you want the impulse to be.

as the description says, this is probably one of the best ways for creating an impulse for a mine.

no i just want the player to get instant force, he is ragdolled and later unragdolled thats set up

Like @targetdior said, you’re gonna want to use :ApplyImpulse. Make sure that youre applying the impulse on the client’s side since they’re the network owner of their character.

oh didnt know it has to be sent via client, good to know (i just looked at forum i can do it via server)

You can do it via server if you make the server the network owner, otherwise it likely wont work (unless it changes when the character is ragdolled somehow)

i call the ragdoll function before the force is apllied, later it is unragdolled

Yeah I just read through it, apparently if you ragdoll the character on the server-side, the server will take over ownership

	character.HumanoidRootPart:ApplyImpulse(CFrame.lookAt(character.HumanoidRootPart.Position, mainPart.Position).LookVector * 1000)

i made this, where mainpart is part from which i want player to get shot away from, but it doesnt seem to yeet player

first is vector, second is the velocity to send

Are you calling the Impulse on the client or on the server now?

server, right after ragdoll, should i add a delay or…?

i just noticed i made the vector wrong way

Does the impulse work after you invert the vector?

it seems to sometimes ragdoll weirdly like apply very low force but its random direction and definetly doesnt have 1b+ power, no matter the velocity i set everything is same so it doesnt?

Have you tried getting the vector by doing (HumanoidRootPart.Position-mainPart.Position) and then multiplying that vector? Assuming the mainPart is the mine

i can try i guess, if nothing works i will just use blast pressure but ill lose smth i wanted

Should look something like this

character.HumanoidRootPart:ApplyImpulse((HumanoidRootPart.Position-mainPart.Position)*1000)

i just tried but it seems no matter what i do the force wont be applied