I’m making something where you hit this part and it’s supposed to break the joints of anything nearby except players, but I also want it to do no damage to the player. Here’s what I’ve got:
debounce = false
script.Parent.Touched:Connect(function(part)
if debounce == false then
debounce = true
local exp = Instance.new("Explosion")
exp.Position = part.Position
exp.BlastRadius = 30
exp.BlastPressure = 0
exp.DestroyJointRadiusPercent = 1
exp.Parent = workspace
wait(0.1)
debounce = false
exp.Hit:Connect(function(explosionpart)
if not game:GetService("Players"):GetPlayerFromCharacter(explosionpart.Parent) then
explosionpart:BreakJoints()
end
end)
end
end)
The player that gets hit is not damaged but it appears that the joints of any parts nearby do not break. How can I fix that?
1 Like
I have a question, why would you want the explosion to have no damage to the target?
1 Like
If the player is in a vehicle it breaks the welds of it and destroys it but doesn’t hurt the player
1 Like
And do you know the reason to it?
1 Like
i don’t know why this is relevant but i was going to have the player launch upward using BodyForce or something
what does this have to do with the issue?
1 Like
I apologize, I didn’t read your title correctly. I thought you wanted it to break joints of all parts.
well that would work too. i tried to do the explosionpart.Parent but that didn’t work either
You should try putting the connect event above the wait function. I tried it myself and I did end up losing some joints touching the part.
but i don’t want it to delete joints of the player just a part like in a vehicle
I used breakjoints for that one. I’m not sure how it deleted the part.
sorry, i meant i don’t want it to break the joints of the player, i only want it to break the joints of a part in a model. for example, a vehicle’s windshield
Huh, your title is about breaking the player’s joints. Right? If not, I apologize, but I can’t help you on this one. I’m not very good at it.
no, it’s about breaking the joints a part hit by the explosion that isn’t a player’s body part without hurting the player
Does your modles use weld or something?
yes, my models do indeed use welds.
Does my suggestion work then? I tried it with a model too and it works for me.
the explosion keeps breaking the joints of my accessories which i don’t want
Do you mean your character’s accessories?
yes my character’s accessories
You could either make the part ignore touching your accessories by checking if its parent is an Accessory or some kind of function.
Try this:
if not game:GetService("Players"):GetPlayerFromCharacter(explosionpart.Parent) and not explosionpart.Parent:IsA("Accessory") then
explosionpart:BreakJoints()
end