Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make this script about speed and impact work?

How do I make this script about impact speed work? Basically I want a MeshPart to go transparent after it is hit at 90 speed and above. But, this is not working. Can anyone tell me what to do? I'm a rookie scripter and get most of my stuff off the internet.

part.Touched:Connect(function(hit)
speed = math.sqrt(hit.Velocity.X^2 + hit.Velocity.Y^2 + hit.Velocity.Z^2)
print(speed)

if speed > 90 then 
script.parent.Transparency = 1

I know I need to put an "end" somewhere, but not sure where.

2 comments

0

If you're asking where you need to end each scope, you need to review the basics before attempting to do anything.

0

No, not just that. I'm just asking what I need to do to the whole script to make it work.

1 answer

✓ Accepted answer

Is this what you want?

part.Touched:Connect(function(hit)
speed = math.sqrt(hit.Velocity.X^2 + hit.Velocity.Y^2 + hit.Velocity.Z^2)
print(speed)

if speed > 90 then 
script.Parent.Transparency = 1
end
end)

If you cant place ends, you really need to review the basics before attempting scripts.

This discussion is preserved as it was. New answers, comments, and votes are closed.