SHOW:
|
|
- or go back to the newest paste.
1 | -- GPlayr by ModernLukest. Made for v3rmillion, , etc. | |
2 | -- Note that anyone can hear the music that you play. Just a clarification for what LocalScripts can do. | |
3 | ||
4 | local char = game.Players.LocalPlayer.Character | |
5 | ||
6 | ||
7 | ||
8 | -- CREATING BUTTONS, LABELS, FRAMES, ETC. | |
9 | local gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui) -- CoreGui is buggy, since GPlayr is designed for PlayerGuis, not CoreGuis. | |
10 | local openbtn = Instance.new("TextButton", gui) | |
11 | local closebtn = Instance.new("TextButton", gui) | |
12 | local openguibtn = Instance.new("TextButton", gui) | |
13 | local playmusicint = Instance.new("Frame", gui) | |
14 | local playmusicbtn = Instance.new("ImageButton", playmusicint) | |
15 | local stopmusicbtn = Instance.new("ImageButton", playmusicint) | |
16 | local musicidbox = Instance.new("TextBox", playmusicint) | |
17 | local credit = Instance.new("TextLabel", playmusicint) | |
18 | local title = Instance.new("TextLabel", playmusicint) | |
19 | ||
20 | -- SIZING -- | |
21 | ||
22 | openbtn.Size = UDim2.new(0, 100, 0, 50) | |
23 | closebtn.Size = UDim2.new(0, 100, 0, 50) | |
24 | openguibtn.Size = UDim2.new(0, 100, 0, 50) | |
25 | playmusicbtn.Size = UDim2.new(0, 50, 0, 50) | |
26 | stopmusicbtn.Size = UDim2.new(0, 57, 0, 57) | |
27 | musicidbox.Size = UDim2.new(0, 300, 0, 50) | |
28 | credit.Size = UDim2.new(0, 300, 0, 20) | |
29 | title.Size = UDim2.new(0, 300, 0, 30) | |
30 | playmusicint.Size = UDim2.new(0, 300, 0, 500) | |
31 | ||
32 | -- POSITIONING -- | |
33 | ||
34 | openbtn.Position = UDim2.new(0, 0, 0, 510) | |
35 | closebtn.Position = UDim2.new(0, 0, 0, 510) | |
36 | openguibtn.Position = UDim2.new(0, 0, 0, 590) | |
37 | playmusicbtn.Position = UDim2.new(0, 50, 0, 200) | |
38 | stopmusicbtn.Position = UDim2.new(0, 175, 0, 197) | |
39 | musicidbox.Position = UDim2.new(0, 0, 0, 100) | |
40 | credit.Position = UDim2.new(0, 0, 0, 470) | |
41 | title.Position = UDim2.new(0, 0, 0, 0) | |
42 | playmusicint.Position = UDim2.new(0, 200, 0, 100) | |
43 | ||
44 | -- SET TEXT -- | |
45 | ||
46 | title.Text = "GPlayr (BETA)" | |
47 | credit.Text = "GPlayr & radio scripting by Developer / ModernLukest" | |
48 | musicidbox.Text = "Enter Sound ID Here" | |
49 | openbtn.Text = "Take Out Radio" | |
50 | closebtn.Text = "Put Away Radio" | |
51 | openguibtn.Text = "Open/Close Music GUI" | |
52 | ||
53 | -- SET IMAGE IDS -- | |
54 | playmusicbtn.Image = "rbxassetid://499381047" | |
55 | stopmusicbtn.Image = "rbxassetid://499381006" | |
56 | ||
57 | -- BACKGROUND COLOR3 -- | |
58 | ||
59 | playmusicint.BackgroundColor3 = Color3.new(136, 136, 136) | |
60 | openbtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
61 | closebtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
62 | openguibtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255) | |
63 | musicidbox.BackgroundColor3 = Color3.fromRGB(109, 109, 109) | |
64 | ||
65 | -- BACKGROUND TRANSPARENCY -- | |
66 | ||
67 | playmusicint.BackgroundTransparency = 0.9 | |
68 | playmusicbtn.BackgroundTransparency = 1 | |
69 | stopmusicbtn.BackgroundTransparency = 1 | |
70 | musicidbox.BackgroundTransparency = 0.43 | |
71 | credit.BackgroundTransparency = 1 | |
72 | title.BackgroundTransparency = 1 | |
73 | ||
74 | -- BORDER SIZE PIXEL -- | |
75 | ||
76 | musicidbox.BorderSizePixel = 0 | |
77 | openbtn.BorderSizePixel = 3 | |
78 | closebtn.BorderSizePixel = 3 | |
79 | openguibtn.BorderSizePixel = 3 | |
80 | ||
81 | -- FONTS -- | |
82 | musicidbox.Font = "SourceSansLight" | |
83 | credit.Font = "SourceSansLight" | |
84 | title.Font = "SourceSansLight" | |
85 | ||
86 | ||
87 | -- TEXT SCALED -- | |
88 | credit.TextScaled = true | |
89 | title.TextScaled = true | |
90 | ||
91 | -- TEXT WRAPPED -- | |
92 | musicidbox.TextWrapped = true | |
93 | credit.TextWrapped = true | |
94 | title.TextWrapped = true | |
95 | openguibtn.TextWrapped = true | |
96 | ||
97 | -- FONT SIZE -- | |
98 | musicidbox.FontSize = "Size28" | |
99 | ||
100 | -- ACTIVE -- | |
101 | playmusicint.Active = true | |
102 | ||
103 | -- DRAGGABLE -- | |
104 | playmusicint.Draggable = true | |
105 | ||
106 | -- GUI FUNCTIONS (MAIN) -- | |
107 | ||
108 | -- set up the stuff -- | |
109 | isGuiOpen = false | |
110 | closebtn.Visible = false | |
111 | playmusicint.Visible = false | |
112 | openguibtn.Visible = false | |
113 | ||
114 | openbtn.MouseButton1Click:connect(function() | |
115 | openbtn.Visible = false | |
116 | closebtn.Visible = true | |
117 | ||
118 | local radio = Instance.new("Part", char) | |
119 | radio.Name = "Radio" | |
120 | local mesh = Instance.new("FileMesh", radio) | |
121 | mesh.MeshId = "http://www.roblox.com/asset/?id=212302951" | |
122 | mesh.TextureId = "http://www.roblox.com/asset/?id=212303049" | |
123 | mesh.Scale = Vector3.new(4, 4, 4) | |
124 | mesh.VertexColor = Vector3.new(1, 1, 1) | |
125 | mesh.Offset = Vector3.new(0, 0, 0) | |
126 | ||
127 | ||
128 | local function weldBetween(a, b) | |
129 | local weld = Instance.new("ManualWeld") | |
130 | weld.Part0 = a | |
131 | weld.Part1 = b | |
132 | weld.C0 = CFrame.new() | |
133 | weld.C1 = b.CFrame:inverse() * a.CFrame | |
134 | weld.Parent = a | |
135 | return weld; | |
136 | end | |
137 | local hand = radio:clone() | |
138 | hand.Parent=char | |
139 | hand.CFrame=char:WaitForChild("Torso").CFrame*CFrame.new(Vector3.new(0,0,0.9))*CFrame.Angles(0,math.rad(180),math.rad(45)) | |
140 | weldBetween(char:WaitForChild("Torso"), hand) | |
141 | hand.CanCollide=true | |
142 | hand.Anchored=false | |
143 | ||
144 | sound = Instance.new("Sound", hand) -- we will now call the radio "hand" | |
145 | - | sound.Volume = 0.5 |
145 | + | sound.Volume = 10 |
146 | sound.Pitch = 1 | |
147 | ||
148 | openguibtn.Visible = true | |
149 | char:FindFirstChild("Radio"):Destroy() | |
150 | end) | |
151 | ||
152 | ||
153 | closebtn.MouseButton1Click:connect(function() | |
154 | openbtn.Visible = true | |
155 | closebtn.Visible = false | |
156 | openguibtn.Visible = false | |
157 | playmusicint.Visible = false | |
158 | isGuiOpen = false | |
159 | char:WaitForChild("Radio"):Destroy() | |
160 | end) | |
161 | ||
162 | playmusicbtn.MouseButton1Click:connect(function() | |
163 | sound:stop() | |
164 | wait(0.2) | |
165 | sound.SoundId = "rbxassetid://"..musicidbox.Text | |
166 | sound:play() | |
167 | end) | |
168 | ||
169 | stopmusicbtn.MouseButton1Click:connect(function() | |
170 | sound:stop() | |
171 | end) | |
172 | ||
173 | ||
174 | openguibtn.MouseButton1Click:connect(function() | |
175 | if isGuiOpen == false then isGuiOpen = true | |
176 | playmusicint.Visible = true else isGuiOpen = false playmusicint.Visible = false | |
177 | end | |
178 | end) |