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