of     2   
chevron_rightchevron_rightchevron_right

doot_d0ot
#218156522Sunday, June 04, 2017 5:52 PM GMT

local boom = Instance.new("Explosion") local fire = Instance.new("Fire") local velx = math.abs(script.Parent.Velocity.X) local velz = math.abs(script.Parent.Velocity.Z) function onTouched(hit) if hit.Name == "CarPart" and (velx or velz > 500) then fire.Parent = hit boom.Parent = hit boom.BlastPressure = 500000 boom.BlastRadius = 1 boom.Position = hit.Position hit:BreakJoints() end end script.Parent.Touched:connect(onTouched) What this is supposed to do is check if the car is moving a certain speed. If it is, it's supposed to destroy anything named 'CarPart' when it hits it if the car's speed exceeds 500. But currently it just destroys anything named CarPart, regardless of speed. Help?
doot_d0ot
#218156988Sunday, June 04, 2017 5:59 PM GMT

bump
KapKing47
#218157453Sunday, June 04, 2017 6:04 PM GMT

The problem is in this line: if hit.Name == "CarPart" and (velx or velz > 500) then Mainly this chunk: (velx or velz > 500) The system is going like "Oh, velx isn't nil, I don't need to get into the 'or' part, I'm returning true." cos u didn't do velx > 500, u gotta keep re-typing this stuff for every variable.
doot_d0ot
#218157461Sunday, June 04, 2017 6:04 PM GMT

bump
doot_d0ot
#218157593Sunday, June 04, 2017 6:06 PM GMT

How would I fix that then? I want it to work if the the car is going 500 in the x OR z direction, not just if both are true.
KapKing47
#218157727Sunday, June 04, 2017 6:08 PM GMT

As I said, type "> 500" for EVERY variable, u did the velz > 500 so I assume u know how to do the same for the velx :P
doot_d0ot
#218158184Sunday, June 04, 2017 6:15 PM GMT

Like this? if hit.Name == "CarPart" and (velx > 500 or velz > 500) then
doot_d0ot
#218158291Sunday, June 04, 2017 6:16 PM GMT

Because that didn't work
KapKing47
#218158604Sunday, June 04, 2017 6:21 PM GMT

It should work, although if I were u I'd probably isolate the X and Z axes in the Vector3 value and then get the magnitude of that instead of checking both values separately.
doot_d0ot
#218159029Sunday, June 04, 2017 6:27 PM GMT

How would I do that?
doot_d0ot
#218159286Sunday, June 04, 2017 6:31 PM GMT

I feel really stupid because nothing that I've tried is working.
KapKing47
#218159409Sunday, June 04, 2017 6:33 PM GMT

local velocity = Vector3.new(script.Parent.Velocity.X, 0, script.Parent.Velocity.Z) --Code if hit.Name == "CarPart" and velocity.Magnitude > 500 then --Code
doot_d0ot
#218159738Sunday, June 04, 2017 6:38 PM GMT

The reason that doesn't work is because there's a possibility that the velocity could be negative. On the particular map I'm using, the car goes 0, 0, -750. That's why I'm trying to use Absolute value, so no matter what the number is positive.
KapKing47
#218160039Sunday, June 04, 2017 6:43 PM GMT

.Magnitude is ALWAYS positive.
fret13103
#218160064Sunday, June 04, 2017 6:43 PM GMT

workspace.Car:Destroy()
doot_d0ot
#218160541Sunday, June 04, 2017 6:50 PM GMT

Even doing what you said, it's not breaking anything. local boom = Instance.new("Explosion") local fire = Instance.new("Fire") local velocity = Vector3.new(script.Parent.Velocity.X, 0, script.Parent.Velocity.Z) function onTouched(hit) if hit.Name == "CarPart" and velocity.Magnitude > 500 then fire.Parent = hit boom.Parent = hit boom.BlastPressure = 500000 boom.BlastRadius = 1 boom.Position = hit.Position hit:BreakJoints() end end script.Parent.Touched:connect(onTouched)
KapKing47
#218160999Sunday, June 04, 2017 6:57 PM GMT

Ah, the breaking part would be hit.Parent:BreakJoints() cos if used on a part I think it only disconnects that 1 part from the parts it's connected to.
doot_d0ot
#218162026Sunday, June 04, 2017 7:12 PM GMT

This is so frustrating, I don't know why it's not working. In other BreakJoints scripts that I use, it's only hit:BreakJoints. For example, here's a script I use that works. function onTouched(hit) if hit.Name == "Part" then hit:BreakJoints() elseif hit.Name == "Wedge" then hit:BreakJoints() elseif hit.Name == "Smooth Block Model" then hit:BreakJoints() elseif hit.Name == "car part" then hit:BreakJoints() elseif hit.Name == "Body Part" then hit:BreakJoints() elseif hit.Name == "Union" then hit:BreakJoints() end end connection = script.Parent.Touched:connect(onTouched) and another one that I use that works: function touched(hit) local boom = Instance.new("Explosion") local fire = Instance.new("Fire") if hit.Velocity.magnitude > 500 then fire.Parent = hit boom.Parent = hit boom.BlastPressure = 50###### #bo################ 1 boom.Position = hit.Position end end script.Parent.Touched:connect(touched) The thing is, those are both places inside walls that break cars when they hit it (they're anchored)
KapKing47
#218162395Sunday, June 04, 2017 7:17 PM GMT

"Returns: void Description: Breaks any surface connection with any adjacent part, including Welds and other JointInstances." Show us a GIF of the problem.
doot_d0ot
#218162729Sunday, June 04, 2017 7:22 PM GMT

hold on working on it
doot_d0ot
#218162995Sunday, June 04, 2017 7:26 PM GMT

Script: ################################################## Proof parts are named right: ################################################## Results: ##################################################
doot_d0ot
#218163067Sunday, June 04, 2017 7:27 PM GMT

Try again ###################################################################
doot_d0ot
#218163087Sunday, June 04, 2017 7:27 PM GMT

great. It won't let me post Gyazo links
KapKing47
#218163276Sunday, June 04, 2017 7:30 PM GMT

Post the Id of it.
doot_d0ot
#218163342Sunday, June 04, 2017 7:31 PM GMT

84dbe7e9fdf909cd98abf35ac1360b88

    of     2   
chevron_rightchevron_rightchevron_right