Advertisement
Guest User

Untitled

a guest
Dec 9th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.17 KB | None | 0 0
  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. -------------------
  88.  
  89. -- GPlayr by ModernLukest. Made for v3rmillion, , etc.
  90. -- Note that anyone can hear the music that you play. Just a clarification for what LocalScripts can do.
  91.  
  92. local char = owner
  93.  
  94.  
  95.  
  96. -- CREATING BUTTONS, LABELS, FRAMES, ETC.
  97. local gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui) -- CoreGui is buggy, since GPlayr is designed for PlayerGuis, not CoreGuis.
  98. local openbtn = Instance.new("TextButton", gui)
  99. local closebtn = Instance.new("TextButton", gui)
  100. local openguibtn = Instance.new("TextButton", gui)
  101. local playmusicint = Instance.new("Frame", gui)
  102. local playmusicbtn = Instance.new("ImageButton", playmusicint)
  103. local stopmusicbtn = Instance.new("ImageButton", playmusicint)
  104. local musicidbox = Instance.new("TextBox", playmusicint)
  105. local credit = Instance.new("TextLabel", playmusicint)
  106. local title = Instance.new("TextLabel", playmusicint)
  107.  
  108. -- SIZING --
  109.  
  110. openbtn.Size = UDim2.new(0, 100, 0, 50)
  111. closebtn.Size = UDim2.new(0, 100, 0, 50)
  112. openguibtn.Size = UDim2.new(0, 100, 0, 50)
  113. playmusicbtn.Size = UDim2.new(0, 50, 0, 50)
  114. stopmusicbtn.Size = UDim2.new(0, 57, 0, 57)
  115. musicidbox.Size = UDim2.new(0, 300, 0, 50)
  116. credit.Size = UDim2.new(0, 300, 0, 20)
  117. title.Size = UDim2.new(0, 300, 0, 30)
  118. playmusicint.Size = UDim2.new(0, 300, 0, 500)
  119.  
  120. -- POSITIONING --
  121.  
  122. openbtn.Position = UDim2.new(0, 0, 0, 510)
  123. closebtn.Position = UDim2.new(0, 0, 0, 510)
  124. openguibtn.Position = UDim2.new(0, 0, 0, 590)
  125. playmusicbtn.Position = UDim2.new(0, 50, 0, 200)
  126. stopmusicbtn.Position = UDim2.new(0, 175, 0, 197)
  127. musicidbox.Position = UDim2.new(0, 0, 0, 100)
  128. credit.Position = UDim2.new(0, 0, 0, 470)
  129. title.Position = UDim2.new(0, 0, 0, 0)
  130. playmusicint.Position = UDim2.new(0, 200, 0, 100)
  131.  
  132. -- SET TEXT --
  133.  
  134. title.Text = "GPlayr (BETA)"
  135. credit.Text = "GPlayr & radio scripting by Developer / ModernLukest"
  136. musicidbox.Text = "Enter Sound ID Here"
  137. openbtn.Text = "Take Out Radio"
  138. closebtn.Text = "Put Away Radio"
  139. openguibtn.Text = "Open/Close Music GUI"
  140.  
  141. -- SET IMAGE IDS --
  142. playmusicbtn.Image = "rbxassetid://499381047"
  143. stopmusicbtn.Image = "rbxassetid://499381006"
  144.  
  145. -- BACKGROUND COLOR3 --
  146.  
  147. playmusicint.BackgroundColor3 = Color3.new(136, 136, 136)
  148. openbtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  149. closebtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  150. openguibtn.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  151. musicidbox.BackgroundColor3 = Color3.fromRGB(109, 109, 109)
  152.  
  153. -- BACKGROUND TRANSPARENCY --
  154.  
  155. playmusicint.BackgroundTransparency = 0.9
  156. playmusicbtn.BackgroundTransparency = 1
  157. stopmusicbtn.BackgroundTransparency = 1
  158. musicidbox.BackgroundTransparency = 0.43
  159. credit.BackgroundTransparency = 1
  160. title.BackgroundTransparency = 1
  161.  
  162. -- BORDER SIZE PIXEL --
  163.  
  164. musicidbox.BorderSizePixel = 0
  165. openbtn.BorderSizePixel = 3
  166. closebtn.BorderSizePixel = 3
  167. openguibtn.BorderSizePixel = 3
  168.  
  169. -- FONTS --
  170. musicidbox.Font = "SourceSansLight"
  171. credit.Font = "SourceSansLight"
  172. title.Font = "SourceSansLight"
  173.  
  174.  
  175. -- TEXT SCALED --
  176. credit.TextScaled = true
  177. title.TextScaled = true
  178.  
  179. -- TEXT WRAPPED --
  180. musicidbox.TextWrapped = true
  181. credit.TextWrapped = true
  182. title.TextWrapped = true
  183. openguibtn.TextWrapped = true
  184.  
  185. -- FONT SIZE --
  186. musicidbox.FontSize = "Size28"
  187.  
  188. -- ACTIVE --
  189. playmusicint.Active = true
  190.  
  191. -- DRAGGABLE --
  192. playmusicint.Draggable = true
  193.  
  194. -- GUI FUNCTIONS (MAIN) --
  195.  
  196. -- set up the stuff --
  197. isGuiOpen = false
  198. closebtn.Visible = false
  199. playmusicint.Visible = false
  200. openguibtn.Visible = false
  201.  
  202. openbtn.MouseButton1Click:connect(function()
  203. openbtn.Visible = false
  204. closebtn.Visible = true
  205.  
  206. local radio = Instance.new("Part", char)
  207. radio.Name = "Radio"
  208. local mesh = Instance.new("FileMesh", radio)
  209. mesh.MeshId = "http://www.roblox.com/asset/?id=212302951"
  210. mesh.TextureId = "http://www.roblox.com/asset/?id=212303049"
  211. mesh.Scale = Vector3.new(4, 4, 4)
  212. mesh.VertexColor = Vector3.new(1, 1, 1)
  213. mesh.Offset = Vector3.new(0, 0, 0)
  214.  
  215.  
  216. local function weldBetween(a, b)
  217. local weld = Instance.new("ManualWeld")
  218. weld.Part0 = a
  219. weld.Part1 = b
  220. weld.C0 = CFrame.new()
  221. weld.C1 = b.CFrame:inverse() * a.CFrame
  222. weld.Parent = a
  223. return weld;
  224. end
  225. local hand = radio:clone()
  226. hand.Parent=char
  227. hand.CFrame=char:WaitForChild("Torso").CFrame*CFrame.new(Vector3.new(0,0,0.9))*CFrame.Angles(0,math.rad(180),math.rad(45))
  228. weldBetween(char:WaitForChild("Torso"), hand)
  229. hand.CanCollide=true
  230. hand.Anchored=false
  231.  
  232. sound = Instance.new("Sound", hand) -- we will now call the radio "hand"
  233. sound.Volume = 0.5
  234. sound.Pitch = 1
  235.  
  236. openguibtn.Visible = true
  237. char:FindFirstChild("Radio"):Destroy()
  238. end)
  239.  
  240.  
  241. closebtn.MouseButton1Click:connect(function()
  242. openbtn.Visible = true
  243. closebtn.Visible = false
  244. openguibtn.Visible = false
  245. playmusicint.Visible = false
  246. isGuiOpen = false
  247. char:WaitForChild("Radio"):Destroy()
  248. end)
  249.  
  250. playmusicbtn.MouseButton1Click:connect(function()
  251. sound:stop()
  252. wait(0.2)
  253. sound.SoundId = "rbxassetid://"..musicidbox.Text
  254. sound:play()
  255. end)
  256.  
  257. stopmusicbtn.MouseButton1Click:connect(function()
  258. sound:stop()
  259. end)
  260.  
  261.  
  262. openguibtn.MouseButton1Click:connect(function()
  263. if isGuiOpen == false then isGuiOpen = true
  264. playmusicint.Visible = true else isGuiOpen = false playmusicint.Visible = false
  265. end
  266. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement