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

Help w/ PlayerAdded event?

Asked by
FiredDusk 1466 Moderation Voter
9 years ago

I want this script to make the players head turn 0.5 Transparecy when they join(PlayerAdded)

Player = game.Players.character.Head
game.Players.PlayerAdded:connect(function(Player)
    Player.Transparency = 0.5
end)

2 answers

Log in to vote
1
Answered by
RoyMer 301 Moderation Voter
9 years ago

There you go

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)   
    character.Head.Transparency = 0.5
end)
end)
Ad
Log in to vote
0
Answered by
NotSoNorm 777 Moderation Voter
9 years ago

You're over defining 'player'

--Let's not define 'Player' because you then redefine it
game.Players.PlayerAdded:connect(function(plr)
    game.Workspace[plr.Name].Head.Transparency = .5
end)
1
Although this method works, I find that it can break, and it only runs once when the player joins, and that this will only work on Roblox studio.. It's better to use plr.Character.Head.Transparency, but the other answer is better since PlayerAdded is only when the player joins. The reason why it wont work in Online mode is that the character isn't done loading when even the PlayerAdded event fired Nickoakz 231 — 9y

Answer this question