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

Could somone help with this snow plow script?

Asked by 10 years ago

When a part named "Snow" touches the plow (this script is in the plow) The brick's Transparency will be changed to one, but this doesn't work.

function Touched(a)
    if a.Parent:FindFirstChild("Snow") then
        a.parent:FindFirstChild("Snow")Transparency = 1
    end


end



script.Parent.Touched:connect(Touched)

1 answer

Log in to vote
3
Answered by
Redbullusa 1580 Moderation Voter
10 years ago

If you want that to work, capitalize "P" for Parent and add a period after ("Snow") on line 02.

function Touched(a)
    if a.Parent:FindFirstChild("Snow") then
        a.Parent:FindFirstChild("Snow").Transparency = 1
    end
end

script.Parent.Touched:connect(Touched)

A better way you could manipulate your statement is to perhaps try 'a.Name == "Snow"' instead.

function Touched(a)
    if a.Name == "Snow" then
        a.Transparency = 1
    end
end

script.Parent.Touched:connect(Touched)

0
Thanks, Red! My_Comment 95 — 10y
0
You're welcome. Redbullusa 1580 — 10y
Ad

Answer this question