Advertisement
BAconTUbe

GOld radio FE

Jan 26th, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.29 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end
  6.  
  7.  
  8. -- GPlayr by ModernLukest. Made for v3rmillion, , etc.
  9. -- Note that anyone can hear the music that you play. Just a clarification for what LocalScripts can do.
  10.  
  11. local char = game.Players.LocalPlayer.Character
  12.  
  13.  
  14.  
  15. -- CREATING BUTTONS, LABELS, FRAMES, ETC.
  16. local gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui) -- CoreGui is buggy, since GPlayr is designed for PlayerGuis, not CoreGuis.
  17. local openbtn = Instance.new("TextButton", gui)
  18. local closebtn = Instance.new("TextButton", gui)
  19. local openguibtn = Instance.new("TextButton", gui)
  20. local playmusicint = Instance.new("Frame", gui)
  21. local playmusicbtn = Instance.new("ImageButton", playmusicint)
  22. local stopmusicbtn = Instance.new("ImageButton", playmusicint)
  23. local musicidbox = Instance.new("TextBox", playmusicint)
  24. local credit = Instance.new("TextLabel", playmusicint)
  25. local title = Instance.new("TextLabel", playmusicint)
  26.  
  27. -- SIZING --
  28.  
  29. openbtn.Size = UDim2.new(0, 100, 0, 50)
  30. closebtn.Size = UDim2.new(0, 100, 0, 50)
  31. openguibtn.Size = UDim2.new(0, 100, 0, 50)
  32. playmusicbtn.Size = UDim2.new(0, 50, 0, 50)
  33. stopmusicbtn.Size = UDim2.new(0, 57, 0, 57)
  34. musicidbox.Size = UDim2.new(0, 300, 0, 50)
  35. credit.Size = UDim2.new(0, 300, 0, 20)
  36. title.Size = UDim2.new(0, 300, 0, 30)
  37. playmusicint.Size = UDim2.new(0, 300, 0, 500)
  38.  
  39. -- POSITIONING --
  40.  
  41. openbtn.Position = UDim2.new(0, 0, 0, 510)
  42. closebtn.Position = UDim2.new(0, 0, 0, 510)
  43. openguibtn.Position = UDim2.new(0, 0, 0, 590)
  44. playmusicbtn.Position = UDim2.new(0, 50, 0, 200)
  45. stopmusicbtn.Position = UDim2.new(0, 175, 0, 197)
  46. musicidbox.Position = UDim2.new(0, 0, 0, 100)
  47. credit.Position = UDim2.new(0, 0, 0, 470)
  48. title.Position = UDim2.new(0, 0, 0, 0)
  49. playmusicint.Position = UDim2.new(0, 200, 0, 100)
  50.  
  51. -- SET TEXT --
  52.  
  53. title.Text = "GPlayr (BETA)"
  54. credit.Text = "GPlayr & radio scripting by Developer / ModernLukest"
  55. musicidbox.Text = "Enter Sound ID Here"
  56. openbtn.Text = "Take Out Radio"
  57. closebtn.Text = "Put Away Radio"
  58. openguibtn.Text = "Open/Close Music GUI"
  59.  
  60. -- SET IMAGE IDS --
  61. playmusicbtn.Image = "rbxassetid://499381047"
  62. stopmusicbtn.Image = "rbxassetid://499381006"
  63.  
  64. -- BACKGROUND COLOR3 --
  65.  
  66. playmusicint.BackgroundColor3 = Color3.new(136, 136, 136)
  67. openbtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  68. closebtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  69. openguibtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  70. musicidbox.BackgroundColor3 = Color3.fromRGB(109, 109, 109)
  71.  
  72. -- BACKGROUND TRANSPARENCY --
  73.  
  74. playmusicint.BackgroundTransparency = 0.9
  75. playmusicbtn.BackgroundTransparency = 1
  76. stopmusicbtn.BackgroundTransparency = 1
  77. musicidbox.BackgroundTransparency = 0.43
  78. credit.BackgroundTransparency = 1
  79. title.BackgroundTransparency = 1
  80.  
  81. -- BORDER SIZE PIXEL --
  82.  
  83. musicidbox.BorderSizePixel = 0
  84. openbtn.BorderSizePixel = 3
  85. closebtn.BorderSizePixel = 3
  86. openguibtn.BorderSizePixel = 3
  87.  
  88. -- FONTS --
  89. musicidbox.Font = "SourceSansLight"
  90. credit.Font = "SourceSansLight"
  91. title.Font = "SourceSansLight"
  92.  
  93.  
  94. -- TEXT SCALED --
  95. credit.TextScaled = true
  96. title.TextScaled = true
  97.  
  98. -- TEXT WRAPPED --
  99. musicidbox.TextWrapped = true
  100. credit.TextWrapped = true
  101. title.TextWrapped = true
  102. openguibtn.TextWrapped = true
  103.  
  104. -- FONT SIZE --
  105. musicidbox.FontSize = "Size28"
  106.  
  107. -- ACTIVE --
  108. playmusicint.Active = true
  109.  
  110. -- DRAGGABLE --
  111. playmusicint.Draggable = true
  112.  
  113. -- GUI FUNCTIONS (MAIN) --
  114.  
  115. -- set up the stuff --
  116. isGuiOpen = false
  117. closebtn.Visible = false
  118. playmusicint.Visible = false
  119. openguibtn.Visible = false
  120.  
  121. openbtn.MouseButton1Click:connect(function()
  122. openbtn.Visible = false
  123. closebtn.Visible = true
  124.  
  125. local radio = Instance.new("Part", char)
  126. radio.Name = "Radio"
  127. local mesh = Instance.new("FileMesh", radio)
  128. mesh.MeshId = "http://www.roblox.com/asset/?id=212302951"
  129. mesh.TextureId = "http://www.roblox.com/asset/?id=212303049"
  130. mesh.Scale = Vector3.new(4, 4, 4)
  131. mesh.VertexColor = Vector3.new(1, 1, 1)
  132. mesh.Offset = Vector3.new(0, 0, 0)
  133.  
  134.  
  135. local function weldBetween(a, b)
  136. local weld = Instance.new("ManualWeld")
  137. weld.Part0 = a
  138. weld.Part1 = b
  139. weld.C0 = CFrame.new()
  140. weld.C1 = b.CFrame:inverse() * a.CFrame
  141. weld.Parent = a
  142. return weld;
  143. end
  144. local hand = radio:clone()
  145. hand.Parent=char
  146. hand.CFrame=char:WaitForChild("Torso").CFrame*CFrame.new(Vector3.new(0,0,0.9))*CFrame.Angles(0,math.rad(180),math.rad(45))
  147. weldBetween(char:WaitForChild("Torso"), hand)
  148. hand.CanCollide=true
  149. hand.Anchored=false
  150.  
  151. sound = Instance.new("Sound", hand) -- we will now call the radio "hand"
  152. sound.Volume = 0.5
  153. sound.Pitch = 1
  154.  
  155. openguibtn.Visible = true
  156. char:FindFirstChild("Radio"):Destroy()
  157. end)
  158.  
  159.  
  160. closebtn.MouseButton1Click:connect(function()
  161. openbtn.Visible = true
  162. closebtn.Visible = false
  163. openguibtn.Visible = false
  164. playmusicint.Visible = false
  165. isGuiOpen = false
  166. char:WaitForChild("Radio"):Destroy()
  167. end)
  168.  
  169. playmusicbtn.MouseButton1Click:connect(function()
  170. sound:stop()
  171. wait(0.2)
  172. sound.SoundId = "rbxassetid://"..musicidbox.Text
  173. sound:play()
  174. end)
  175.  
  176. stopmusicbtn.MouseButton1Click:connect(function()
  177. sound:stop()
  178. end)
  179.  
  180.  
  181. openguibtn.MouseButton1Click:connect(function()
  182. if isGuiOpen == false then isGuiOpen = true
  183. playmusicint.Visible = true else isGuiOpen = false playmusicint.Visible = false
  184. end
  185. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement