Whenever I fire the weapon with this script, the weapon falls apart. It's a SBC cannon from Serious Sam (I Know, pretty serious, right? Lol) and whenever I fire it, the gun itself breaks. Anyway to rewrite it so it doesn't make the gun fall apart?
function onTouched(hit) hit:BreakJoints() end connection = script.Parent.Touched:connect(onTouched)
The "connection" are being triggered, because the bullet are touching the weapon. Thats what I think.
I'd make sure the hit
isn't a child of a Tool
.
function onTouched(hit) -- remember to indent scopes for clean looking code :) if not hit.Parent:IsA("Tool") then hit:BreakJoints() end end connection = script.Parent.Touched:connect(onTouched)