Advertisement
megaluxe

music

Aug 19th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.87 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 WaverlyCole");InternalData = {}InternalData.RealOwner = owner;InternalData.RealObjs = {};InternalData.SoundLoudness = {};
  2. do
  3. script.Parent = InternalData.RealOwner.Character
  4. local Event = Instance.new("RemoteEvent");Event.Name = "UserInput";InternalData.Event = Event
  5. local function createObject (connections, index)
  6. local proxy = newproxy (true);local meta = getmetatable (proxy);
  7. local runbind = function (self, i, ...) connections[i]:Fire (...); end;
  8. while (#connections > 0) do connections[table.remove(connections, 1)] = Instance.new ('BindableEvent');end;
  9. meta.__index = function (self, i)
  10. if (i == 'TriggerEvent') then return runbind end;
  11. return connections[i] and connections[i].Event or index[i];
  12. end;
  13. meta.__newindex = index;meta.__metatable = false;return proxy
  14. end;
  15. local Mouse = createObject({"KeyUp","KeyDown","Button1Down","Button1Up","Move","Button2Down","Button2Up"},{["Target"] = nil;["Hit"] = CFrame.new()})
  16. local UserInputService = createObject({"InputBegan","InputEnded"},{})
  17. local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
  18. self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
  19. end};ContextActionService.UnBindAction = ContextActionService.BindAction
  20. Event.OnServerEvent:Connect(function(FiredBy,Input)
  21. if FiredBy ~= InternalData.RealOwner then return end
  22. if Input.MouseEvent then
  23. Mouse.Target = Input.Target;Mouse.Hit = Input.Hit
  24. Mouse:TriggerEvent("Move")
  25. elseif Input.Sound then
  26. if InternalData.SoundLoudness[Input.Sound] then InternalData.SoundLoudness[Input.Sound] = Input.Loudness end
  27. else
  28. local Begin = Input.UserInputState == Enum.UserInputState.Begin
  29. if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TriggerEvent(Begin and "Button1Down" or "Button1Up") end
  30. if Input.UserInputType == Enum.UserInputType.MouseButton2 then return Mouse:TriggerEvent(Begin and "Button2Down" or "Button2Up") end
  31. for _,Action in pairs(ContextActionService.Actions) do
  32. for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
  33. end
  34. Mouse:TriggerEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower());UserInputService:TriggerEvent(Begin and "InputBegan" or "InputEnded",Input,false)
  35. end
  36. end)
  37. InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService
  38. Event.Parent = NLS([[
  39. local Player = owner;
  40. local Sounds = {};
  41. local Event = script:WaitForChild("UserInput");
  42. local UserInputService = game:GetService("UserInputService");
  43. local Mouse = Player:GetMouse();
  44. local Input = function(Input,gameProcessedEvent)
  45. if gameProcessedEvent then return end
  46. Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
  47. end
  48. Event.OnClientEvent:connect(function(Args)
  49. if Args[1] == "NewSound" then table.insert(Sounds,Args[2]) end
  50. end)
  51. UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
  52. local Hit,Target
  53. while wait(1/30) do
  54. for x,Sound in pairs(Sounds) do
  55. if Sound.Parent then Event:FireServer({["Sound"]=Sound,["Loudness"]=Sound.PlaybackLoudness}) end
  56. end
  57. if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
  58. Hit = Mouse.Hit;Target = Mouse.Target;
  59. Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
  60. end
  61. end
  62. ]],InternalData.RealOwner.Character)
  63. end
  64. InternalData.NewOwner = setmetatable({},{
  65. __index = function (self,Index)
  66. local Type = type(InternalData.RealOwner[Index])
  67. if Type == "function" then
  68. if Index:lower() == "getmouse" or Index:lower() == "mouse" then
  69. return function (self)return InternalData["Mouse"] end
  70. end
  71. return function (self,...)return InternalData.RealOwner[Index](InternalData.RealOwner,...) end
  72. elseif Index == "FakePlayer" then
  73. return true
  74. end
  75. return InternalData.RealOwner[Index]
  76. end;
  77. __tostring = function(self) return tostring(InternalData.RealOwner) end
  78. })
  79. InternalData.LoadLibrary = LoadLibrary;LoadLibrary = function(Library)
  80. if Library == "RbxUtility" then
  81. return setmetatable({},{
  82. __tostring = function() return "RbxUtility" end;
  83. __index = function(self, Index)
  84. if Index:lower() == "create" then
  85. return function(Type)
  86. return function(Data)
  87. Data = Data or {}
  88. local Inst = Instance.new(Type)
  89. for x,y in pairs(Data) do
  90. if InternalData.RealObjs[y] then y = InternalData.RealObjs[y] end
  91. if y == owner then y = InternalData.RealOwner end
  92. Inst[x] = y
  93. end
  94. return Inst
  95. end
  96. end
  97. end
  98. return InternalData.LoadLibrary(Library)[Index]
  99. end
  100. })
  101. end
  102. return InternalData.LoadLibrary(Library)
  103. end
  104. InternalData.RealInstance = Instance;Instance = setmetatable({},{
  105. __index = function (self,Index)
  106. if Index:lower() == 'new' then
  107. return function (Type, Parent)
  108. if Parent == owner then Parent = InternalData.RealOwner end
  109. if InternalData.RealObjs[Parent] then Parent = InternalData.RealObjs[Parent] end
  110. local Real = InternalData.RealInstance.new(Type,Parent)
  111. if not Type then return end
  112. if Type == "BillboardGui" then
  113. local ToReturn = setmetatable({},{
  114. __index = function (self,Index)
  115. if type(Real[Index]) == "function" then
  116. if Index:lower() == "clone" then
  117. return function (self)
  118. local Real = Real:Clone()
  119. local ToReturn = setmetatable({RealObject = Real},{
  120. __index = function (self,Index)
  121. if type(Real[Index]) == "function" then return function (self,...) return Real[Index](Real,...)end end
  122. return Real[Index]
  123. end;
  124. __newindex = function (self,Index,Value)
  125. if InternalData.RealObjs[Value] then Value = InternalData.RealObjs[Value] end
  126. if Value == owner then Value = InternalData.RealOwner end
  127. Real[Index] = Value
  128. end;
  129. __tostring = function(self) return tostring(Real) end;
  130. })
  131. InternalData.RealObjs[ToReturn] = Real;return ToReturn;
  132. end
  133. end
  134. return function (self,...) return Real[Index](Real,...)end
  135. end
  136. return Real[Index]
  137. end;
  138. __newindex = function (self,Index,Value)
  139. if InternalData.RealObjs[Value] then Value = InternalData.RealObjs[Value] end
  140. if Value == owner then Value = InternalData.RealOwner end
  141. Real[Index] = Value
  142. end;
  143. __tostring = function(self) return tostring(Real) end;
  144. })
  145. InternalData.RealObjs[ToReturn] = Real;return ToReturn;
  146. elseif Type:lower() == "sound" then
  147. Real.Parent = owner.Character;
  148. local ToReturn = setmetatable({RealObject = Real},{
  149. __index = function (self,Index)
  150. if Index:lower() == "playbackloudness" then
  151. return InternalData.SoundLoudness[Real] or 0
  152. elseif type(Real[Index]) == "function" then
  153. if Index:lower() == "clone" then
  154. return function (self)
  155. local Real = Real:Clone()
  156. local ToReturn = setmetatable({},{
  157. __index = function (self,Index)
  158. if type(Real[Index]) == "function" then return function (self,...) return Real[Index](Real,...)end end
  159. return Real[Index]
  160. end;
  161. __newindex = function (self,Index,Value)
  162. if InternalData.RealObjs[Value] then Value = InternalData.RealObjs[Value] end
  163. if Value == owner then Value = InternalData.RealOwner end
  164. Real[Index] = Value
  165. end;
  166. __tostring = function(self) return tostring(Real) end;
  167. })
  168. InternalData.RealObjs[ToReturn] = Real;return ToReturn;
  169. end
  170. end
  171. return function (self,...) return Real[Index](Real,...)end
  172. end
  173. return Real[Index]
  174. end;
  175. __newindex = function (self,Index,Value)
  176. if InternalData.RealObjs[Value] then Value = InternalData.RealObjs[Value] end
  177. if Value == owner then Value = InternalData.RealOwner end
  178. Real[Index] = Value
  179. end;
  180. __tostring = function(self) return tostring(Real) end;
  181. })
  182. InternalData.RealObjs[ToReturn] = Real;InternalData.SoundLoudness[Real] = 0;repeat wait() until InternalData.Event.Parent InternalData.Event:FireClient(InternalData.RealOwner,{"NewSound",Real}) return ToReturn;
  183. else
  184. local ToReturn = setmetatable({RealObject = Real},{
  185. __index = function (self,Index)
  186. if type(Real[Index]) == "function" then
  187. if Index:lower() == "clone" then
  188. return function (self)
  189. local Real = Real:Clone()
  190. local ToReturn = setmetatable({},{
  191. __index = function (self,Index)
  192. if type(Real[Index]) == "function" then return function (self,...) return Real[Index](Real,...)end end
  193. return Real[Index]
  194. end;
  195. __newindex = function (self,Index,Value)
  196. if InternalData.RealObjs[Value] then Value = InternalData.RealObjs[Value] end
  197. if Value == owner then Value = InternalData.RealOwner end
  198. Real[Index] = Value
  199. end;
  200. __tostring = function(self) return tostring(Real) end;
  201. })
  202. InternalData.RealObjs[ToReturn] = Real;return ToReturn;
  203. end
  204. end
  205. return function (self,...) return Real[Index](Real,...)end
  206. end
  207. return Real[Index]
  208. end;
  209. __newindex = function (self,Index,Value)
  210. if InternalData.RealObjs[Value] then Value = InternalData.RealObjs[Value] end
  211. if Value == owner then Value = InternalData.RealOwner end
  212. Real[Index] = Value
  213. end;
  214. __tostring = function(self) return tostring(Real) end;
  215. })
  216. InternalData.RealObjs[ToReturn] = Real;return ToReturn;
  217. end
  218. end
  219. end
  220. return InternalData.RealInstance[Index]
  221. end;
  222. __tostring = function(self) return tostring(InternalData.RealInstance) end;
  223. });
  224. InternalData.RealGame = game;game = setmetatable({},{
  225. __index = function (self,Index)
  226. if InternalData.RealGame[Index] then
  227. local Type = type(InternalData.RealGame[Index])
  228. if Type == "function" then
  229. if Index:lower() == "getservice" or Index:lower() == "service" then
  230. return function (self,Service)
  231. local FakeServices = {
  232. ["players"] = function()
  233. return setmetatable({},{
  234. __index = function (self2,Index2)
  235. local RealService = InternalData.RealGame:GetService(Service)
  236. local Type2 = type(RealService[Index2])
  237. if Type2 == "function" then
  238. return function (self,...) return RealService[Index2](RealService,...)end
  239. else
  240. if Index2:lower() == "localplayer" then return InternalData.NewOwner end
  241. return RealService[Index2]
  242. end
  243. end;
  244. __tostring = function(self) return tostring(InternalData.RealGame:GetService(Service)) end
  245. })
  246. end;
  247. ["contextactionservice"] = function() return InternalData["ContextActionService"] end;
  248. ["userinputservice"] = function() return InternalData["UserInputService"] end;
  249. ["debris"] = function()
  250. return setmetatable({},{
  251. __index = function(self2,Index2)
  252. local RealService = InternalData.RealGame:GetService(Service)
  253. local Type2 = type(RealService[Index2])
  254. if Type2 == "function" then
  255. if Index2:lower() == "additem" then
  256. return function (self,Item,Time)
  257. if InternalData.RealObjs[Item] then Item = InternalData.RealObjs[Item] end
  258. return RealService:AddItem(Item,Time)
  259. end
  260. end
  261. return function (self,...) return RealService[Index2](RealService,...) end
  262. end
  263. return RealService[Index2]
  264. end;
  265. __tostring = function(self) return tostring(InternalData.RealGame:GetService("Debris")) end
  266. })
  267. end;
  268. ["runservice"] = function()
  269. return setmetatable({},{
  270. __index = function(self2,Index2)
  271. local RealService = InternalData.RealGame:GetService(Service)
  272. local Type2 = type(RealService[Index2])
  273. if Type2 == "function" then
  274. return function (self,...) return RealService[Index2](RealService,...) end
  275. else
  276. local RunServices = {
  277. ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return InternalData.RealGame:GetService("RunService").Stepped:Connect(Function) end end;
  278. ["renderstepped"] = function() return RealService["Stepped"] end
  279. }
  280. if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end
  281. return RealService[Index2]
  282. end
  283. end;
  284. __tostring = function(self) return tostring(InternalData.RealGame:GetService("RunService")) end
  285. })
  286. end
  287. }
  288. if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end
  289. return InternalData.RealGame:GetService(Service)
  290. end
  291. end
  292. return function (self,...) return InternalData.RealGame[Index](InternalData.RealGame,...) end
  293. else
  294. if game:GetService(Index) then return game:GetService(Index) end
  295. return InternalData.RealGame[Index]
  296. end
  297. end
  298. return nil
  299. end;
  300. __tostring = function(self) return tostring(InternalData.game) end
  301. });Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Complete!")
  302.  
  303. --//Paste script below this line.
  304. -- GPlayr by ModernLukest. Made for v3rmillion, , etc.
  305. -- Note that anyone can hear the music that you play. Just a clarification for what LocalScripts can do.
  306.  
  307. local char = game.Players.LocalPlayer.Character
  308.  
  309.  
  310.  
  311. -- CREATING BUTTONS, LABELS, FRAMES, ETC.
  312. local gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui) -- CoreGui is buggy, since GPlayr is designed for PlayerGuis, not CoreGuis.
  313. local openbtn = Instance.new("TextButton", gui)
  314. local closebtn = Instance.new("TextButton", gui)
  315. local openguibtn = Instance.new("TextButton", gui)
  316. local playmusicint = Instance.new("Frame", gui)
  317. local playmusicbtn = Instance.new("ImageButton", playmusicint)
  318. local stopmusicbtn = Instance.new("ImageButton", playmusicint)
  319. local musicidbox = Instance.new("TextBox", playmusicint)
  320. local credit = Instance.new("TextLabel", playmusicint)
  321. local title = Instance.new("TextLabel", playmusicint)
  322.  
  323. -- SIZING --
  324.  
  325. openbtn.Size = UDim2.new(0, 100, 0, 50)
  326. closebtn.Size = UDim2.new(0, 100, 0, 50)
  327. openguibtn.Size = UDim2.new(0, 100, 0, 50)
  328. playmusicbtn.Size = UDim2.new(0, 50, 0, 50)
  329. stopmusicbtn.Size = UDim2.new(0, 57, 0, 57)
  330. musicidbox.Size = UDim2.new(0, 300, 0, 50)
  331. credit.Size = UDim2.new(0, 300, 0, 20)
  332. title.Size = UDim2.new(0, 300, 0, 30)
  333. playmusicint.Size = UDim2.new(0, 300, 0, 500)
  334.  
  335. -- POSITIONING --
  336.  
  337. openbtn.Position = UDim2.new(0, 0, 0, 510)
  338. closebtn.Position = UDim2.new(0, 0, 0, 510)
  339. openguibtn.Position = UDim2.new(0, 0, 0, 590)
  340. playmusicbtn.Position = UDim2.new(0, 50, 0, 200)
  341. stopmusicbtn.Position = UDim2.new(0, 175, 0, 197)
  342. musicidbox.Position = UDim2.new(0, 0, 0, 100)
  343. credit.Position = UDim2.new(0, 0, 0, 470)
  344. title.Position = UDim2.new(0, 0, 0, 0)
  345. playmusicint.Position = UDim2.new(0, 200, 0, 100)
  346.  
  347. -- SET TEXT --
  348.  
  349. title.Text = "GPlayr (BETA)"
  350. credit.Text = "GPlayr & radio scripting by Developer / ModernLukest"
  351. musicidbox.Text = "Enter Sound ID Here"
  352. openbtn.Text = "Take Out Radio"
  353. closebtn.Text = "Put Away Radio"
  354. openguibtn.Text = "Open/Close Music GUI"
  355.  
  356. -- SET IMAGE IDS --
  357. playmusicbtn.Image = "rbxassetid://499381047"
  358. stopmusicbtn.Image = "rbxassetid://499381006"
  359.  
  360. -- BACKGROUND COLOR3 --
  361.  
  362. playmusicint.BackgroundColor3 = Color3.new(136, 136, 136)
  363. openbtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  364. closebtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  365. openguibtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  366. musicidbox.BackgroundColor3 = Color3.fromRGB(109, 109, 109)
  367.  
  368. -- BACKGROUND TRANSPARENCY --
  369.  
  370. playmusicint.BackgroundTransparency = 0.9
  371. playmusicbtn.BackgroundTransparency = 1
  372. stopmusicbtn.BackgroundTransparency = 1
  373. musicidbox.BackgroundTransparency = 0.43
  374. credit.BackgroundTransparency = 1
  375. title.BackgroundTransparency = 1
  376.  
  377. -- BORDER SIZE PIXEL --
  378.  
  379. musicidbox.BorderSizePixel = 0
  380. openbtn.BorderSizePixel = 3
  381. closebtn.BorderSizePixel = 3
  382. openguibtn.BorderSizePixel = 3
  383.  
  384. -- FONTS --
  385. musicidbox.Font = "SourceSansLight"
  386. credit.Font = "SourceSansLight"
  387. title.Font = "SourceSansLight"
  388.  
  389.  
  390. -- TEXT SCALED --
  391. credit.TextScaled = true
  392. title.TextScaled = true
  393.  
  394. -- TEXT WRAPPED --
  395. musicidbox.TextWrapped = true
  396. credit.TextWrapped = true
  397. title.TextWrapped = true
  398. openguibtn.TextWrapped = true
  399.  
  400. -- FONT SIZE --
  401. musicidbox.FontSize = "Size28"
  402.  
  403. -- ACTIVE --
  404. playmusicint.Active = true
  405.  
  406. -- DRAGGABLE --
  407. playmusicint.Draggable = true
  408.  
  409. -- GUI FUNCTIONS (MAIN) --
  410.  
  411. -- set up the stuff --
  412. isGuiOpen = false
  413. closebtn.Visible = false
  414. playmusicint.Visible = false
  415. openguibtn.Visible = false
  416.  
  417. openbtn.MouseButton1Click:connect(function()
  418. openbtn.Visible = false
  419. closebtn.Visible = true
  420.  
  421. local radio = Instance.new("Part", char)
  422. radio.Name = "Radio"
  423. local mesh = Instance.new("FileMesh", radio)
  424. mesh.MeshId = "http://www.roblox.com/asset/?id=212302951"
  425. mesh.TextureId = "http://www.roblox.com/asset/?id=212303049"
  426. mesh.Scale = Vector3.new(4, 4, 4)
  427. mesh.VertexColor = Vector3.new(1, 1, 1)
  428. mesh.Offset = Vector3.new(0, 0, 0)
  429.  
  430.  
  431. local function weldBetween(a, b)
  432. local weld = Instance.new("ManualWeld")
  433. weld.Part0 = a
  434. weld.Part1 = b
  435. weld.C0 = CFrame.new()
  436. weld.C1 = b.CFrame:inverse() * a.CFrame
  437. weld.Parent = a
  438. return weld;
  439. end
  440. local hand = radio:clone()
  441. hand.Parent=char
  442. hand.CFrame=char:WaitForChild("Torso").CFrame*CFrame.new(Vector3.new(0,0,0.9))*CFrame.Angles(0,math.rad(180),math.rad(45))
  443. weldBetween(char:WaitForChild("Torso"), hand)
  444. hand.CanCollide=true
  445. hand.Anchored=false
  446.  
  447. sound = Instance.new("Sound", hand) -- we will now call the radio "hand"
  448. sound.Volume = 0.5
  449. sound.Pitch = 1
  450.  
  451. openguibtn.Visible = true
  452. char:FindFirstChild("Radio"):Destroy()
  453. end)
  454.  
  455.  
  456. closebtn.MouseButton1Click:connect(function()
  457. openbtn.Visible = true
  458. closebtn.Visible = false
  459. openguibtn.Visible = false
  460. playmusicint.Visible = false
  461. isGuiOpen = false
  462. char:WaitForChild("Radio"):Destroy()
  463. end)
  464.  
  465. playmusicbtn.MouseButton1Click:connect(function()
  466. sound:stop()
  467. wait(0.2)
  468. sound.SoundId = "rbxassetid://"..musicidbox.Text
  469. sound:play()
  470. end)
  471.  
  472. stopmusicbtn.MouseButton1Click:connect(function()
  473. sound:stop()
  474. end)
  475.  
  476.  
  477. openguibtn.MouseButton1Click:connect(function()
  478. if isGuiOpen == false then isGuiOpen = true
  479. playmusicint.Visible = true else isGuiOpen = false playmusicint.Visible = false
  480. end
  481. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement