Advertisement
JOJOJOJOJOJO1234

Untitled

Jul 18th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86.  
  87. local char = owner.Character
  88.  
  89.  
  90. m.TrigEvent = te
  91. UIS.TrigEvent = te
  92.  
  93. Event.OnServerEvent:Connect(function(plr,io)
  94. if plr~=Player then return end
  95. if io.isMouse then
  96. m.Target = io.Target
  97. m.Hit = io.Hit
  98. else
  99. local b = io.UserInputState == Enum.UserInputState.Begin
  100. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  101. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  102. end
  103. for _,t in pairs(CAS.Actions) do
  104. for _,k in pairs(t.Keys) do
  105. if k==io.KeyCode then
  106. t.Function(t.Name,io.UserInputState,io)
  107. end
  108. end
  109. end
  110. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  111. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  112. end
  113. end)
  114. Event.Parent = NLS([==[
  115. local Player = game:GetService("Players").LocalPlayer
  116. local Event = script:WaitForChild("UserInput_Event")
  117.  
  118. local UIS = game:GetService("UserInputService")
  119. local input = function(io,a)
  120. if a then return end
  121. --Since InputObject is a client-side instance, we create and pass table instead
  122. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  123. end
  124. UIS.InputBegan:Connect(input)
  125. UIS.InputEnded:Connect(input)
  126.  
  127. local Mouse = Player:GetMouse()
  128. local h,t
  129. --Give the server mouse data 30 times every second, but only if the values changed
  130. --If player is not moving their mouse, client won't fire events
  131. while wait(1/30) do
  132. if h~=Mouse.Hit or t~=Mouse.Target then
  133. h,t=Mouse.Hit,Mouse.Target
  134. Event:FireServer({isMouse=true,Target=t,Hit=h})
  135. end
  136. end]==],Player.Character)
  137. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  138. end
  139.  
  140. -- CREATING BUTTONS, LABELS, FRAMES, ETC.
  141. local gui = Instance.new("ScreenGui", owner.PlayerGui) -- CoreGui is buggy, since GPlayr is designed for PlayerGuis, not CoreGuis.
  142. local openbtn = Instance.new("TextButton", gui)
  143. local closebtn = Instance.new("TextButton", gui)
  144. local openguibtn = Instance.new("TextButton", gui)
  145. local playmusicint = Instance.new("Frame", gui)
  146. local playmusicbtn = Instance.new("ImageButton", playmusicint)
  147. local stopmusicbtn = Instance.new("ImageButton", playmusicint)
  148. local musicidbox = Instance.new("TextBox", playmusicint)
  149. local credit = Instance.new("TextLabel", playmusicint)
  150. local title = Instance.new("TextLabel", playmusicint)
  151.  
  152. -- SIZING --
  153.  
  154. openbtn.Size = UDim2.new(0, 100, 0, 50)
  155. closebtn.Size = UDim2.new(0, 100, 0, 50)
  156. openguibtn.Size = UDim2.new(0, 100, 0, 50)
  157. playmusicbtn.Size = UDim2.new(0, 50, 0, 50)
  158. stopmusicbtn.Size = UDim2.new(0, 57, 0, 57)
  159. musicidbox.Size = UDim2.new(0, 300, 0, 50)
  160. credit.Size = UDim2.new(0, 300, 0, 20)
  161. title.Size = UDim2.new(0, 300, 0, 30)
  162. playmusicint.Size = UDim2.new(0, 300, 0, 500)
  163.  
  164. -- POSITIONING --
  165.  
  166. openbtn.Position = UDim2.new(0, 0, 0, 510)
  167. closebtn.Position = UDim2.new(0, 0, 0, 510)
  168. openguibtn.Position = UDim2.new(0, 0, 0, 590)
  169. playmusicbtn.Position = UDim2.new(0, 50, 0, 200)
  170. stopmusicbtn.Position = UDim2.new(0, 175, 0, 197)
  171. musicidbox.Position = UDim2.new(0, 0, 0, 100)
  172. credit.Position = UDim2.new(0, 0, 0, 470)
  173. title.Position = UDim2.new(0, 0, 0, 0)
  174. playmusicint.Position = UDim2.new(0, 200, 0, 100)
  175.  
  176. -- SET TEXT --
  177.  
  178. title.Text = "GPlayr (BETA)"
  179. credit.Text = "GPlayr & radio scripting by Developer / ModernLukest"
  180. musicidbox.Text = "Enter Sound ID Here"
  181. openbtn.Text = "Take Out Radio"
  182. closebtn.Text = "Put Away Radio"
  183. openguibtn.Text = "Open/Close Music GUI"
  184.  
  185. -- SET IMAGE IDS --
  186. playmusicbtn.Image = "rbxassetid://499381047"
  187. stopmusicbtn.Image = "rbxassetid://499381006"
  188.  
  189. -- BACKGROUND COLOR3 --
  190.  
  191. playmusicint.BackgroundColor3 = Color3.new(136, 136, 136)
  192. openbtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  193. closebtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  194. openguibtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  195. musicidbox.BackgroundColor3 = Color3.fromRGB(109, 109, 109)
  196.  
  197. -- BACKGROUND TRANSPARENCY --
  198.  
  199. playmusicint.BackgroundTransparency = 0.9
  200. playmusicbtn.BackgroundTransparency = 1
  201. stopmusicbtn.BackgroundTransparency = 1
  202. musicidbox.BackgroundTransparency = 0.43
  203. credit.BackgroundTransparency = 1
  204. title.BackgroundTransparency = 1
  205.  
  206. -- BORDER SIZE PIXEL --
  207.  
  208. musicidbox.BorderSizePixel = 0
  209. openbtn.BorderSizePixel = 3
  210. closebtn.BorderSizePixel = 3
  211. openguibtn.BorderSizePixel = 3
  212.  
  213. -- FONTS --
  214. musicidbox.Font = "SourceSansLight"
  215. credit.Font = "SourceSansLight"
  216. title.Font = "SourceSansLight"
  217.  
  218.  
  219. -- TEXT SCALED --
  220. credit.TextScaled = true
  221. title.TextScaled = true
  222.  
  223. -- TEXT WRAPPED --
  224. musicidbox.TextWrapped = true
  225. credit.TextWrapped = true
  226. title.TextWrapped = true
  227. openguibtn.TextWrapped = true
  228.  
  229. -- FONT SIZE --
  230. musicidbox.FontSize = "Size28"
  231.  
  232. -- ACTIVE --
  233. playmusicint.Active = true
  234.  
  235. -- DRAGGABLE --
  236. playmusicint.Draggable = true
  237.  
  238. -- GUI FUNCTIONS (MAIN) --
  239.  
  240. -- set up the stuff --
  241. isGuiOpen = false
  242. closebtn.Visible = false
  243. playmusicint.Visible = false
  244. openguibtn.Visible = false
  245.  
  246. openbtn.MouseButton1Click:connect(function()
  247. openbtn.Visible = false
  248. closebtn.Visible = true
  249.  
  250. local radio = Instance.new("Part", char)
  251. radio.Name = "Radio"
  252. local mesh = Instance.new("FileMesh", radio)
  253. mesh.MeshId = "http://www.roblox.com/asset/?id=212302951"
  254. mesh.TextureId = "http://www.roblox.com/asset/?id=212303049"
  255. mesh.Scale = Vector3.new(4, 4, 4)
  256. mesh.VertexColor = Vector3.new(1, 1, 1)
  257. mesh.Offset = Vector3.new(0, 0, 0)
  258.  
  259.  
  260. local function weldBetween(a, b)
  261. local weld = Instance.new("ManualWeld")
  262. weld.Part0 = a
  263. weld.Part1 = b
  264. weld.C0 = CFrame.new()
  265. weld.C1 = b.CFrame:inverse() * a.CFrame
  266. weld.Parent = a
  267. return weld;
  268. end
  269. local hand = radio:clone()
  270. hand.Parent=char
  271. hand.CFrame=char:WaitForChild("Torso").CFrame*CFrame.new(Vector3.new(0,0,0.9))*CFrame.Angles(0,math.rad(180),math.rad(45))
  272. weldBetween(char:WaitForChild("Torso"), hand)
  273. hand.CanCollide=true
  274. hand.Anchored=false
  275.  
  276. sound = Instance.new("Sound", hand) -- we will now call the radio "hand"
  277. sound.Volume = 0.5
  278. sound.Pitch = 1
  279.  
  280. openguibtn.Visible = true
  281. char:FindFirstChild("Radio"):Destroy()
  282. end)
  283.  
  284.  
  285. closebtn.MouseButton1Click:connect(function()
  286. openbtn.Visible = true
  287. closebtn.Visible = false
  288. openguibtn.Visible = false
  289. playmusicint.Visible = false
  290. isGuiOpen = false
  291. char:WaitForChild("Radio"):Destroy()
  292. end)
  293.  
  294. playmusicbtn.MouseButton1Click:connect(function()
  295. sound:stop()
  296. wait(0.2)
  297. sound.SoundId = "rbxassetid://"..musicidbox.Text
  298. sound:play()
  299. end)
  300.  
  301. stopmusicbtn.MouseButton1Click:connect(function()
  302. sound:stop()
  303. end)
  304.  
  305.  
  306. openguibtn.MouseButton1Click:connect(function()
  307. if isGuiOpen == false then isGuiOpen = true
  308. playmusicint.Visible = true else isGuiOpen = false playmusicint.Visible = false
  309. end
  310. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement