Answered by
6 years ago Edited 6 years ago
Ok, so here are a few problems with your script - you don't use :ChildAdded
when you want to do something when a player joins - you use :PlayerAdded
, the second problem is that the contents inside of StarterGui get copied into the player when they join, so any modification made to anything inside of StarterGui after the player has joined WON'T modify the player's gui. The contents of StarterGui actually get copied inside of Player.PlayerGui (Player being whatever the player's name is), so a fix for that would be:
01 | game.Players:PlayerAdded:connect( function (player) ~~~note the usage of PlayerAdded instead of ChildAdded |
02 | local h = player.Character:WaitForChild( "Humanoid" ) |
03 | local Torso = h.Parent:FindFirstChild( "Torso" ) |
05 | local Smoke = Instance.new( "Smoke" ) |
08 | Smoke.Color = Color 3. new( 209 , 0 , 255 ) |
10 | Smoke.RiseVelocity = 0 |
14 | local StickyBombValue = Instance.new( "IntValue" ) |
15 | StickyBombValue.Parent = child |
16 | StickyBombValue.Name = "StickyBombValue" |
18 | local ImageLabel = player.PlayerGui.ScreenGui:FindFirstChild( "PlayerImage" ) |
19 | ImageLabel.Parent = game.StarterGui.ScreenGui |
20 | ImageLabel.Position = UDim 2. new( 0 , 25 , 0 , 50 ) |
21 | ImageLabel.Size = UDim 2. new( 0 , 100 , 0 , 100 ) |
23 | ImageLabel.BackgroundColor 3 = Color 3. new( 207 , 207 , 207 ) |
Additional explanations - the reason the code works after you put the part with the image label after the ChildAdded event block is because that code runs when the server starts, before the player/child added event is fired, so the image label is modified inside of StarterGui before the player joins, thus the modified contents of StarterGui get copied into the PlayerGui of the player.
~~~if I made any mistakes please point them out in the comments, thanks!~~~