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
8 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

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

1 answer

Log in to vote
0
Answered by
Validark 1580 Snack Break Moderation Voter
8 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

1local Seat = workspace.Seat
2local Block = workspace.Block
3 
4Seat.ChildAdded:Connect(function(child)
5    if child.Name == "SeatWeld" then
6        Block.Transparency = 0.5
7    end
8end)
Ad

Answer this question