SyntaxIsHere

Untitled

Nov 11th, 2018
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.28 KB | None | 0 0
  1.  
  2. --https://github.com/Mokiros/roblox-FE-compatibility
  3. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  4. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  5. local RealPlayer = Player
  6. 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 typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u 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 rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},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")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end
  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)
Add Comment
Please, Sign In to add comment