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

What am I missing in the script to make my tire smoke on turns?

Asked by 9 years ago

I've been working on a project to help me learn and understand more of scripting but as I was developing the game I've reached a problem in my kart script. I'm trying to make my kart smoke go to opacity 1 whenever the car steering turns into 1 or -1. Before i did the -1 I want to start with only steer 1 but it seems that the smoke still won't come up from opacity 0 to 1 during the steer of 1. Please help thanks.

local BackLeftTireSmoke = script.Parent.BackLeftTire.Smoke.Opacity

while true do 
    wait(0.01)
    if script.Parent.VehicleSeat.Steer == 1
        then BackLeftTireSmoke = 1
    end
end

EDIT**** I fund out that if I turn fire instead pops up in my BackLEftTire part but doesnt even ignite Actually yhe fire could be from the friction I set up the tires to

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

When you created BackLeftTireSmoke, you see it yo the opacity of the smoke. All that does is set the variable to that number -- it doesn't "link" the property to the variable.

Think about it this way: do you ever actually write in your code, set the opacity of this smoke object to 1? No--you only change some variable to one.

Instead define a smoke variant which is script.Parent.BackLeftTire.Smoke and change smoke.Opacity in your loop.

Ad

Answer this question