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

Why doesn't this work?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
function onTouched(hit) 
if hit.Name == "Red" then
script.Parent.Parent.Tire1.Friction = script.Parent.Parent.Tire1.Friction - .005
script.Parent.Parent.Tire2.Friction = script.Parent.Parent.Tire2.Friction - .005
script.Parent.Parent.Tire3.Friction = script.Parent.Parent.Tire3.Friction - .005
script.Parent.Parent.Tire4.Friction = script.Parent.Parent.Tire4.Friction - .005
else
if hit.Name == "Yellow" then
script.Parent.Parent.Tire1.Friction = script.Parent.Parent.Tire1.Friction - .007
script.Parent.Parent.Tire2.Friction = script.Parent.Parent.Tire2.Friction - .007
script.Parent.Parent.Tire3.Friction = script.Parent.Parent.Tire3.Friction - .007
script.Parent.Parent.Tire4.Friction = script.Parent.Parent.Tire4.Friction - .007
else
if hit.Name == "Blue" then
script.Parent.Parent.Tire1.Friction = script.Parent.Parent.Tire1.Friction - .009
script.Parent.Parent.Tire2.Friction = script.Parent.Parent.Tire2.Friction - .009
script.Parent.Parent.Tire3.Friction = script.Parent.Parent.Tire3.Friction - .009
script.Parent.Parent.Tire4.Friction = script.Parent.Parent.Tire4.Friction - .009
else
if hit.Name == "Pit" then
script.Parent.Parent.Tire1.Friction = 1
script.Parent.Parent.Tire2.Friction = 1
script.Parent.Parent.Tire3.Friction = 1
script.Parent.Parent.Tire4.Friction = 1
end
end
end 
script.Parent.Touched:connect(onTouched) 

What is going on here, is that the humanoid is touching bricks named Red, Yellow, Blue, or Pit on a racetrack, and the tires of the car they are in are supposed to change. The script is placed in a car's seat that has the destroy on death script.

Answer this question