Helgodxdd

Radio

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