Advertisement
StarzoZero

Roblox Gold Radio Script (Testing Stage)

Jan 9th, 2019
1,809
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.25 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient()then error("Please run as a server script. Use h/ instead of hl/.")end;print("FE Compatibility: by StarzoZero");InternalData = {}
  2. do
  3. script.Parent = owner.Character
  4. local Event = Instance.new("RemoteEvent");Event.Name = "UserInput"
  5. local function NewFakeEvent()
  6. local Bind = Instance.new("BindableEvent")
  7. local Fake;Fake = {Connections = {},
  8. fakeEvent=true;
  9. Connect=function(self,Func)
  10. Bind.Event:connect(Func)
  11. self.Connections[Bind] = true
  12. return setmetatable({Connected = true},{
  13. __index = function (self,Index)
  14. if Index:lower() == "disconnect" then
  15. return function() Fake.Connections[Bind] = false;self.Connected = false end
  16. end
  17. return Fake[Index]
  18. end;
  19. __tostring = function() return "Connection" end;
  20. })
  21. end}
  22. Fake.connect = Fake.Connect;return Fake;
  23. end
  24. local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
  25. local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
  26. local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
  27. self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
  28. end};ContextActionService.UnBindAction = ContextActionService.BindAction
  29. local function TriggerEvent(self,Event,...)
  30. local Trigger = Mouse[Event]
  31. if Trigger and Trigger.fakeEvent and Trigger.Connections then
  32. for Connection,Active in pairs(Trigger.Connections) do if Active then Connection:Fire(...) end end
  33. end
  34. end
  35. Mouse.TrigEvent = TriggerEvent;UserInputService.TrigEvent = TriggerEvent
  36. Event.OnServerEvent:Connect(function(FiredBy,Input)
  37. if FiredBy.Name ~= owner.Name then return end
  38. if Input.MouseEvent then
  39. Mouse.Target = Input.Target;Mouse.Hit = Input.Hit
  40. else
  41. local Begin = Input.UserInputState == Enum.UserInputState.Begin
  42. if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") end
  43. for _,Action in pairs(ContextActionService.Actions) do
  44. for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
  45. end
  46. Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
  47. UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
  48. end
  49. end)
  50. InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService
  51. Event.Parent = NLS([[
  52. local Player = owner;local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse()
  53. local Input = function(Input,gameProcessedEvent)
  54. if gameProcessedEvent then return end
  55. Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
  56. end
  57. UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
  58. local Hit,Target
  59. while wait(1/30) do
  60. if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
  61. Hit,Target = Mouse.Hit,Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
  62. end
  63. end
  64. ]],owner.Character)
  65. end
  66. RealGame = game;game = setmetatable({},{
  67. __index = function (self,Index)
  68. local Sandbox = function (Thing)
  69. if Thing:IsA("Player") then
  70. local RealPlayer = Thing
  71. return setmetatable({},{
  72. __index = function (self,Index)
  73. local Type = type(RealPlayer[Index])
  74. if Type == "function" then
  75. if Index:lower() == "getmouse" or Index:lower() == "mouse" then
  76. return function (self)return InternalData["Mouse"] end
  77. end
  78. return function (self,...)return RealPlayer[Index](RealPlayer,...) end
  79. end
  80. return RealPlayer[Index]
  81. end;
  82. __tostring = function(self) return RealPlayer.Name end
  83. })
  84. end
  85. end
  86. if RealGame[Index] then
  87. local Type = type(RealGame[Index])
  88. if Type == "function" then
  89. if Index:lower() == "getservice" or Index:lower() == "service" then
  90. return function (self,Service)
  91. local FakeServices = {
  92. ["players"] = function()
  93. return setmetatable({},{
  94. __index = function (self2,Index2)
  95. local RealService = RealGame:GetService(Service)
  96. local Type2 = type(Index2)
  97. if Type2 == "function" then
  98. return function (self,...) return RealService[Index2](RealService,...)end
  99. else
  100. if Index2:lower() == "localplayer" then return Sandbox(owner) end
  101. return RealService[Index2]
  102. end
  103. end;
  104. __tostring = function(self) return RealGame:GetService(Service).Name end
  105. })
  106. end;
  107. ["contextactionservice"] = function() return InternalData["ContextActionService"] end;
  108. ["userinputservice"] = function() return InternalData["UserInputService"] end;
  109. ["runservice"] = function()
  110. return setmetatable({},{
  111. __index = function(self2,Index2)
  112. local RealService = RealGame:GetService(Service)
  113. local Type2 = type(Index2)
  114. if Type2 == "function" then
  115. return function (self,...) return RealService[Index2](RealService,...) end
  116. else
  117. local RunServices = {
  118. ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return RealGame:GetService("RunService").Stepped:Connect(Function) end end;
  119. ["renderstepped"] = function() return RealService["Stepped"] end
  120. }
  121. if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end
  122. return RealService[Index2]
  123. end
  124. end
  125. })
  126. end
  127. }
  128. if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end
  129. return RealGame:GetService(Service)
  130. end
  131. end
  132. return function (self,...) return RealGame[Index](RealGame,...) end
  133. else
  134. if game:GetService(Index) then return game:GetService(Index) end
  135. return RealGame[Index]
  136. end
  137. end
  138. return nil
  139. end
  140. });Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Play till your dead!")
  141. -- GPlayr by ModernLukest. Made for v3rmillion, , etc.
  142. -- Note that anyone can hear the music that you play. Just a clarification for what LocalScripts can do.
  143.  
  144. local char = game.Players.LocalPlayer.Character
  145.  
  146.  
  147.  
  148. -- CREATING BUTTONS, LABELS, FRAMES, ETC.
  149. local gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui) -- CoreGui is buggy, since GPlayr is designed for PlayerGuis, not CoreGuis.
  150. local openbtn = Instance.new("TextButton", gui)
  151. local closebtn = Instance.new("TextButton", gui)
  152. local openguibtn = Instance.new("TextButton", gui)
  153. local playmusicint = Instance.new("Frame", gui)
  154. local playmusicbtn = Instance.new("ImageButton", playmusicint)
  155. local stopmusicbtn = Instance.new("ImageButton", playmusicint)
  156. local musicidbox = Instance.new("TextBox", playmusicint)
  157. local credit = Instance.new("TextLabel", playmusicint)
  158. local title = Instance.new("TextLabel", playmusicint)
  159.  
  160. -- SIZING --
  161.  
  162. openbtn.Size = UDim2.new(0, 100, 0, 50)
  163. closebtn.Size = UDim2.new(0, 100, 0, 50)
  164. openguibtn.Size = UDim2.new(0, 100, 0, 50)
  165. playmusicbtn.Size = UDim2.new(0, 50, 0, 50)
  166. stopmusicbtn.Size = UDim2.new(0, 57, 0, 57)
  167. musicidbox.Size = UDim2.new(0, 300, 0, 50)
  168. credit.Size = UDim2.new(0, 300, 0, 20)
  169. title.Size = UDim2.new(0, 300, 0, 30)
  170. playmusicint.Size = UDim2.new(0, 300, 0, 500)
  171.  
  172. -- POSITIONING --
  173.  
  174. openbtn.Position = UDim2.new(0, 0, 0, 510)
  175. closebtn.Position = UDim2.new(0, 0, 0, 510)
  176. openguibtn.Position = UDim2.new(0, 0, 0, 590)
  177. playmusicbtn.Position = UDim2.new(0, 50, 0, 200)
  178. stopmusicbtn.Position = UDim2.new(0, 175, 0, 197)
  179. musicidbox.Position = UDim2.new(0, 0, 0, 100)
  180. credit.Position = UDim2.new(0, 0, 0, 470)
  181. title.Position = UDim2.new(0, 0, 0, 0)
  182. playmusicint.Position = UDim2.new(0, 200, 0, 100)
  183.  
  184. -- SET TEXT --
  185.  
  186. title.Text = "GPlayr (BETA)"
  187. credit.Text = "GPlayr & radio scripting by Developer / ModernLukest"
  188. musicidbox.Text = "Enter Sound ID Here"
  189. openbtn.Text = "Take Out Radio"
  190. closebtn.Text = "Put Away Radio"
  191. openguibtn.Text = "Open/Close Music GUI"
  192.  
  193. -- SET IMAGE IDS --
  194. playmusicbtn.Image = "rbxassetid://499381047"
  195. stopmusicbtn.Image = "rbxassetid://499381006"
  196.  
  197. -- BACKGROUND COLOR3 --
  198.  
  199. playmusicint.BackgroundColor3 = Color3.new(136, 136, 136)
  200. openbtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  201. closebtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  202. openguibtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  203. musicidbox.BackgroundColor3 = Color3.fromRGB(109, 109, 109)
  204.  
  205. -- BACKGROUND TRANSPARENCY --
  206.  
  207. playmusicint.BackgroundTransparency = 0.9
  208. playmusicbtn.BackgroundTransparency = 1
  209. stopmusicbtn.BackgroundTransparency = 1
  210. musicidbox.BackgroundTransparency = 0.43
  211. credit.BackgroundTransparency = 1
  212. title.BackgroundTransparency = 1
  213.  
  214. -- BORDER SIZE PIXEL --
  215.  
  216. musicidbox.BorderSizePixel = 0
  217. openbtn.BorderSizePixel = 3
  218. closebtn.BorderSizePixel = 3
  219. openguibtn.BorderSizePixel = 3
  220.  
  221. -- FONTS --
  222. musicidbox.Font = "SourceSansLight"
  223. credit.Font = "SourceSansLight"
  224. title.Font = "SourceSansLight"
  225.  
  226.  
  227. -- TEXT SCALED --
  228. credit.TextScaled = true
  229. title.TextScaled = true
  230.  
  231. -- TEXT WRAPPED --
  232. musicidbox.TextWrapped = true
  233. credit.TextWrapped = true
  234. title.TextWrapped = true
  235. openguibtn.TextWrapped = true
  236.  
  237. -- FONT SIZE --
  238. musicidbox.FontSize = "Size28"
  239.  
  240. -- ACTIVE --
  241. playmusicint.Active = true
  242.  
  243. -- DRAGGABLE --
  244. playmusicint.Draggable = true
  245.  
  246. -- GUI FUNCTIONS (MAIN) --
  247.  
  248. -- set up the stuff --
  249. isGuiOpen = false
  250. closebtn.Visible = false
  251. playmusicint.Visible = false
  252. openguibtn.Visible = false
  253.  
  254. openbtn.MouseButton1Click:connect(function()
  255. openbtn.Visible = false
  256. closebtn.Visible = true
  257.  
  258. local radio = Instance.new("Part", char)
  259. radio.Name = "Radio"
  260. local mesh = Instance.new("FileMesh", radio)
  261. mesh.MeshId = "http://www.roblox.com/asset/?id=212302951"
  262. mesh.TextureId = "http://www.roblox.com/asset/?id=212303049"
  263. mesh.Scale = Vector3.new(4, 4, 4)
  264. mesh.VertexColor = Vector3.new(1, 1, 1)
  265. mesh.Offset = Vector3.new(0, 0, 0)
  266.  
  267.  
  268. local function weldBetween(a, b)
  269. local weld = Instance.new("ManualWeld")
  270. weld.Part0 = a
  271. weld.Part1 = b
  272. weld.C0 = CFrame.new()
  273. weld.C1 = b.CFrame:inverse() * a.CFrame
  274. weld.Parent = a
  275. return weld;
  276. end
  277. local hand = radio:clone()
  278. hand.Parent=char
  279. hand.CFrame=char:WaitForChild("Torso").CFrame*CFrame.new(Vector3.new(0,0,0.9))*CFrame.Angles(0,math.rad(180),math.rad(45))
  280. weldBetween(char:WaitForChild("Torso"), hand)
  281. hand.CanCollide=true
  282. hand.Anchored=false
  283.  
  284. sound = Instance.new("Sound", hand) -- we will now call the radio "hand"
  285. sound.Volume = 0.5
  286. sound.Pitch = 1
  287.  
  288. openguibtn.Visible = true
  289. char:FindFirstChild("Radio"):Destroy()
  290. end)
  291.  
  292.  
  293. closebtn.MouseButton1Click:connect(function()
  294. openbtn.Visible = true
  295. closebtn.Visible = false
  296. openguibtn.Visible = false
  297. playmusicint.Visible = false
  298. isGuiOpen = false
  299. char:WaitForChild("Radio"):Destroy()
  300. end)
  301.  
  302. playmusicbtn.MouseButton1Click:connect(function()
  303. sound:stop()
  304. wait(0.2)
  305. sound.SoundId = "rbxassetid://"..musicidbox.Text
  306. sound:play()
  307. end)
  308.  
  309. stopmusicbtn.MouseButton1Click:connect(function()
  310. sound:stop()
  311. end)
  312.  
  313.  
  314. openguibtn.MouseButton1Click:connect(function()
  315. if isGuiOpen == false then isGuiOpen = true
  316. playmusicint.Visible = true else isGuiOpen = false playmusicint.Visible = false
  317. end
  318. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement