Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How To Prevent BreakJoints From Killing Players?

Asked by 7 years ago
Edited 7 years ago

Here is a script that I made to break the joints of connected parts because the parts are unanchored but they are connected by studs and inlets. However, when a player touches it, the player dies too. I assume that this also breaks some of the joints in the player that connect it to the torso and head and stuff. How would I prevent those essential player joints from breaking while letting the parts continue to break joints?

function onTouched(hit)

hit:BreakJoints()

end

1 answer

Log in to vote
1
Answered by
MrHerkes 166
7 years ago
Edited 7 years ago
function onTouched(hit)

if hit.Name == " " then --Between the quotation marks, just name that one specific part.

hit:BreakJoints()

end

end

So basically, this checks for the part's name. If it's the right name, it would break the joints attached to that part.

0
Thank you for this simple answer! I have just tried using it and it works! I don't die anymore! Yay! :D BunnyFilms1 297 — 7y
Ad

Answer this question