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

How to change part transparency from seats being used?

Asked by
Kimuyo 13
7 years ago

this is strange but i am trying to make it so when you sit on a seat named "Seat" it changes the transparency in a part named "Block" is set to 0.5

Seat.ChildAdded:connect(function(child)
    if game.Workspace.Seat.child.Name == "SeatWeld" then
        game.Workspace.Block.Transparency = 0.5
    end
end)

1 answer

Log in to vote
0
Answered by
Validark 1580 Snack Break Moderation Voter
7 years ago

game.Workspace.Seat is the seat, but Seat.child doesn't exist. The child that was added (the Weld) is the variable child

Also, connect should be Connect

local Seat = workspace.Seat
local Block = workspace.Block

Seat.ChildAdded:Connect(function(child)
    if child.Name == "SeatWeld" then
        Block.Transparency = 0.5
    end
end)
Ad

Answer this question