Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Gui created in LocalScript isn't showing up?

I am making a gui in a local script for simplicity reasons and trust me it is better for me to do this but the problem is that the gui won't show up, their is no errors, the local script is in startergui. I will copy/paste the script here and sorry if it's huge but I'm pretty sure you don't need to read all of it.

Player = Game.Players.LocalPlayer
Player:WaitForDataReady()
wait(2)

HexPlayerGui = Instance.new("ScreenGui", script.Parent)
HexPlayerGui.Name = "HexPlayer"
--Created ultimate parent
Main = Instance.new("Frame", HexPlayerGui)
Main.BackgroundColor3 = Color3.new(57,57,57)
Main.BorderSizePixel = 0
Main.Name = "Main"
Main.Position = UDim2.new{0,400},{0, 200}
Main.Size = UDim2.new{0,200},{0,300}
Main.Visible = true
Main.ZIndex = 1
--Created MainFrame
Buttons = Instance.new("Frame", Main)
Buttons.Name = "Main"
Buttons.BackgroundTransparency = 1
Buttons.Size = UDim2.new{1,0},{1,0}
Buttons.Position = UDim2.new{0,0},{0,0}
Buttons.Visible = true
Buttons.ZIndex = 1
--Created ButtonsFrame in Main
	Home = Instance.new("ImageButton", Buttons)
	Home.BackgroundTransparency = 1
	Home.Name = "Home"
	Home.Image = "http://www.roblox.com/asset/?id=180944392"
	Home.Position = UDim2.new{0,75},{0,255}
	Home.Size = UDim2.new{0,50},{0,40}
	Home.ZIndex = 1
	--Created HomeButton inside ButtonsFrame
Screen = Instance.new("Frame")
Screen.Name = "Screen"
Screen.BackgroundColor3 = Color3.new(0,0,0)
Screen.BorderSizePixel = 0
Screen.Position = UDim2.new{0,15},{0,50}
Screen.Size = UDim2.new{0,170},{0,200}
Screen.ZIndex = 1
--Created Screen in Main
	Background = Instance.new("ImageLabel", Screen)
	Background.Transparency = 0
	Background.Name = "Background"
	Background.BackgroundColor3 = Color3.new(0,0,0)
	Background.BorderSizePixel = 0
	Background.Image = "http://www.roblox.com/asset/?id=180945278"
	Background.Size = UDim2.new{1,0},{1,0}
	Background.ZIndex = 1
	--Created Background in Screen
	ActiveApps = Instance.new("Frame")
	ActiveApps.Name = "ActiveApps"
	ActiveApps.BorderSizePixel = 1
	ActiveApps.Position = UDim2.new{0,0},{0,0}
	ActiveApps.Size = UDim2.new{1,0},{1,0}
	ActiveApps.Visible = true
	ActiveApps.ZIndex = 5
	--Created ActiveApps in Screen
		MusicApp = Instance.new("Frame")
		MusicApp.Name = "MusicApp"
		MusicApp.Size  = UDim2.new{1,0},{1,0}
		MusicApp.ZIndex = 6
		MusicApp.Visible = true -- CHANGE TO FALSE ONCE SCRIPT IS FINISHED
		--Created MusicApp in ActiveApps
	    	ActiveSong = Instance.new("Frame", MusicApp)
			ActiveSong.Name = "ActiveSong"
			ActiveSong.BackgroundTransparency = 0
			ActiveSong.BorderSizePixel = 0
			ActiveSong.Position = UDim2.new{0,0},{0,0}
			ActiveSong.Size = UDim2.new{0,0},{0,0}
			ActiveSong.ZIndex = 1
			--Created ActiveSong in MusicApp
			SongsPage = Instance.new("Frame", MusicApp)
			SongsPage.Name = "SongsPage"
			SongsPage.BorderSizePixel = 0
			SongsPage.Size = UDim2.new{1,0},{0,175}
			SongsPage.ZIndex = 8
			--Created SongsPage in MusicApp
				Info = Instance.new("Frame", SongsPage)
				Info.BackgroundColor3 = Color3.new(255,128,0)
				Info.BackgroundTransparency = 0.6
				Info.BorderSizePixel = 0
				Info.Size = UDim2.new{1,0},{0,50}
				Info.ZIndex = 10
				--Created Info in SongsPage
					Playing = Instance.new("TextLabel", SongsPage)
					Playing.BackgroundTransparency = 1
					Playing.Size = UDim2.new{1,0},{0,50}
					Playing.ZIndex = 10
					--Add in Text later--
					--Created Playing in SongsPage
				Songs = Instance.new("ScrollingFrame", SongsPage)
				Songs.BorderSizePixel = 0
				Songs.Position = UDim2.new{0,0},{0,50}
				Songs.Size = UDim2.new{1,0},{0,125}
				Songs.ZIndex = 9
				Songs.CanvasSize = UDim2.new{0,0},{2,0}
				--Created Songs in SongsPage
					--WHERE THE SONGS WILL BE
					song1button = Instance.new("TextButton", Songs)
					song1button.Size = UDim2.new{1, 0},{0, 25}
					song1button.ZIndex = 10
					song1button.Text = "Tsunami"
					--Song buttons end
			Toolbar = Instance.new("Frame", MusicApp)
			Toolbar.BackgroundColor3 = Color3.new(255,128,0)
			Toolbar.BackgroundTransparency = 0.6
			Toolbar.BorderSizePixel = 0
			Toolbar.Position = UDim2.new{0,0},{0,175}
			Toolbar.Size = UDim2.new{1,0},{0,25}
			Toolbar.ZIndex = 6
			--Created Toolbar in MusicApp
				SongsTab = Instance.new("ImageButton", Toolbar)
				SongsTab.BackgroundTransparency = 1
				SongsTab.Image = "http://www.roblox.com/asset/?id=180946620"
				SongsTab.Position = UDim2.new{0,25},{0,0}
				SongsTab.Size = UDim2.new{0,25},{0,25}
				SongsTab.ZIndex = 7
	Info = Instance.new("Frame")
	Info.Size = UDim2.new{1,0},{0,10}
	Info.BackgroundColor3 = Color3.new(0,0,0)
	
	--Creating Music
	song1 = Instance.new("Sound")
	song1.SoundId = "rbxassetid://152775066"
	song1.Name = "Tsunami"
	
	--Real Script beyond this point
	

	

Thanks for your time! :D

2 answers

✓ Accepted answer

There are definitely errors when you run this script. Are you looking in the F9 Developer Console at the Local console?

There is no UDim2 constructor that takes two arguments. Instead of passing in two tables like UDim2.new{0,400},{0, 200}, you need to pass in each number as an argument like this UDim2.new(0,400,0, 200)

Each number in the Color3 constructor needs to be divided by 255. It expects a number between 0 and 1.

Instead of this: Toolbar.BackgroundColor3 = Color3.new(255,128,0) do this: Toolbar.BackgroundColor3 = Color3.new(255/255,128/255,0/255)

I'm sure there are other issues, but you can figure them out if you open up the developer console in online mode by pressing F9.

Line 2, where it says Player:WaitForDataReady(). That command will never finish executing because any reading or writing of player data can only be done from Server-Side Scripts. Which means that Player:WaitForDataReady() won't work either. It won't give you an error, it'll just yield your script forever.

A better replacement would be repeat wait() until Player.Character. This'll yield the script until the Character has loaded.

Hope this helped!

1 comment

0

Didn't help, I believe it doesn't have to do with anything with the character since it is PlayerGui.

This discussion is preserved as it was. New answers, comments, and votes are closed.