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

How to make dust from under the tires in the car?

Asked by 3 years ago

Hello. I am new here. Recently I learned how to make vehicles in a blender, so I'm trying to make a roblox game. My problem is that I don't know much about programming. I would like to know how to make a script that extracts dust from under the tires (I already have ParticleEmitter). Please help! I use A-chassis.

1 answer

Log in to vote
1
Answered by 3 years ago

I don't know how to detect if a part touches terrain but you can make a flat transparent, non collidable part on top of the terrain and detect if the tires are touching that part. Make a part in Workspace and name it to SandPart.

Script:

local neededPart = game.Workspace.SandPart
local dust = --Wherever your dust emitter is
local tire1 = --Wherever the first tire is
local tire2 = --Wherever the second tire is
local tire3 = --Wherever the third tire is
local tire4 = --Wherever the fourth tire is

tire1.Touched:Connect(function(hit)
    if hit.Parent.Name == neededPart then
        dust.Enabled = true
    end
end)

tire2.Touched:Connect(function(hit)
    if hit.Parent.Name == neededPart then
        dust.Enabled = true
    end
end)

tire3.Touched:Connect(function(hit)
    if hit.Parent.Name == neededPart then
        dust.Enabled = true
    end
end)

tire4.Touched:Connect(function(hit)
    if hit.Parent.Name == neededPart then
        dust.Enabled = true
    end
end)

--TouchEnded

tire1.TouchEnded:Connect(function(hit)
    if hit.Parent.Name ~= neededPart then
        dust.Enabled = false
    end
end)

tire2.TouchEnded:Connect(function(hit)
    if hit.Parent.Name ~= neededPart then
        dust.Enabled = false
    end
end)

tire3.TouchEnded:Connect(function(hit)
    if hit.Parent.Name ~= neededPart then
        dust.Enabled = false
    end
end)

tire4.TouchEnded:Connect(function(hit)
    if hit.Parent.Name ~= neededPart then
        dust.Enabled = false
    end
end)

If this does not work, this is just a pseudocode of the working script.

0
It worked, thank you so much!!! MarcinekSt 10 — 3y
0
No problem! FrontsoldierYT 129 — 3y
Ad

Answer this question