function PlayerAdded(np) sg = instance.new("ScreenGui",np.StarterGui) fr = instance.new("Frame",sg) fr.Position = Udim2.new(0,0,0,0) fr.Active = false fr.BackgroundColor3 = Color3.new(8/255,121/255,207/255) fr.BackggroundTransperancy = 0 fr.BorderPixel = 0 fr.Name = "Loading" fr.Style = "RobloxRound" fr.Size = UDim2.new(1,1,1,1) fr2 = instance.new("Frame",sg) fr2.Position = UDim.new(0.5,0,0.4,0) fr2.Active = false fr2.BackgroundColor3 = Color3.new(207/255,13/255,55/255) fr2.BackgroundTransparency = 0 fr2.BorderPixel = 0 fr2.Name = "Loading Bar" fr2.Style = "RobloxSquare" fr2:TweenPosition(UDim2.new(0.2,0,0.4,0),"Out","Linear",5,false,nil) wait(5) sg:Destroy() end
Please do not ask other users to debug your code. Read this article on how to debug your code.
Also, on line two it shouldn't be StarterGui but PlayerGui. And you probably want to wait for it to be added too, but that's a different question.
I haven't read the code but I noticed there is not calling line.
If it still doesn't work try putting the GUI in PlayerGui instead of StarterGui.