Advertisement
Nema69

Untitled

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