How do I make this part disappear in five seconds of the player joining?

how do I make this part disappear in five seconds of the player joining?
I’m new to scripting but I’m trying!.
Script:

game.Players.PlayerAdded:connect(function(plr)

A = script.Parent

A.Transparency = 0

A.CanCollide = true

wait(5)

A.Transparency = 1

A.CanCollide = false

end

1 Like

have you tested? it should work aslong as A is a basepart.

try this:

game.Players.PlayerAdded:Connect(function()

local A = script.Parent

A.CanCollide = true

A.Transparency = 0

wait(5)

A.CanCollide = false

A.Transparency = 1

end)

oh ok

you guys are so kind tysm :smiley:

1 Like

Hmm… my part is just disappearing on spawn?

well each time a player joins it does that sequence of code. so yes it will do it on spawn(but not each time unless you rejoin)

1 Like

i mean its not waiting my counting gui hasent ended by the time its gone

oh okay lemme try that real quick

you never said anything about a counting gui…

1 Like

Oh no i was just using that on the side to count the seconds but when i tried 7 seconds it works now

1 Like

Probably takes a bit longer since there may be a bit of lag when a player initially joins since the game is loading and they are spawning in.

1 Like