Advertisement
HenloMyDude

noteblock

Jun 19th, 2019
1,188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.87 KB | None | 0 0
  1. --MINECRAFT NOTEBLOCK SCRIPT BY HENLOMYDUDE--
  2.  
  3. if game:GetService("RunService"):IsClient()then error("Run as r/ and not rl/")end;print("FE Converter by HenloMyDude");InternalData = {}
  4. do
  5. script.Parent = owner.Character
  6. local Event = Instance.new("RemoteEvent");Event.Name = "UserInput"
  7. local function NewFakeEvent()
  8. local Bind = Instance.new("BindableEvent")
  9. local Fake;Fake = {Connections = {},
  10. fakeEvent=true;
  11. Connect=function(self,Func)
  12. Bind.Event:connect(Func)
  13. self.Connections[Bind] = true
  14. return setmetatable({Connected = true},{
  15. __index = function (self,Index)
  16. if Index:lower() == "disconnect" then
  17. return function() Fake.Connections[Bind] = false;self.Connected = false end
  18. end
  19. return Fake[Index]
  20. end;
  21. __tostring = function() return "Connection" end;
  22. })
  23. end}
  24. Fake.connect = Fake.Connect;return Fake;
  25. end
  26. local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
  27. local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
  28. local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
  29. self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
  30. end};ContextActionService.UnBindAction = ContextActionService.BindAction
  31. local function TriggerEvent(self,Event,...)
  32. local Trigger = Mouse[Event]
  33. if Trigger and Trigger.fakeEvent and Trigger.Connections then
  34. for Connection,Active in pairs(Trigger.Connections) do if Active then Connection:Fire(...) end end
  35. end
  36. end
  37. Mouse.TrigEvent = TriggerEvent;UserInputService.TrigEvent = TriggerEvent
  38. Event.OnServerEvent:Connect(function(FiredBy,Input)
  39. if FiredBy.Name ~= owner.Name then return end
  40. if Input.MouseEvent then
  41. Mouse.Target = Input.Target;Mouse.Hit = Input.Hit
  42. else
  43. local Begin = Input.UserInputState == Enum.UserInputState.Begin
  44. if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") end
  45. for _,Action in pairs(ContextActionService.Actions) do
  46. for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
  47. end
  48. Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
  49. UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
  50. end
  51. end)
  52. InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService
  53. Event.Parent = NLS([[
  54. local Player = owner;local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse()
  55. local Input = function(Input,gameProcessedEvent)
  56. if gameProcessedEvent then return end
  57. Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
  58. end
  59. UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
  60. local Hit,Target
  61. while wait(1/30) do
  62. if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
  63. Hit,Target = Mouse.Hit,Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
  64. end
  65. end
  66. ]],owner.Character)
  67. end
  68. RealGame = game;game = setmetatable({},{
  69. __index = function (self,Index)
  70. local Sandbox = function (Thing)
  71. if Thing:IsA("Player") then
  72. local RealPlayer = Thing
  73. return setmetatable({},{
  74. __index = function (self,Index)
  75. local Type = type(RealPlayer[Index])
  76. if Type == "function" then
  77. if Index:lower() == "getmouse" or Index:lower() == "mouse" then
  78. return function (self)return InternalData["Mouse"] end
  79. end
  80. return function (self,...)return RealPlayer[Index](RealPlayer,...) end
  81. end
  82. return RealPlayer[Index]
  83. end;
  84. __tostring = function(self) return RealPlayer.Name end
  85. })
  86. end
  87. end
  88. if RealGame[Index] then
  89. local Type = type(RealGame[Index])
  90. if Type == "function" then
  91. if Index:lower() == "getservice" or Index:lower() == "service" then
  92. return function (self,Service)
  93. local FakeServices = {
  94. ["players"] = function()
  95. return setmetatable({},{
  96. __index = function (self2,Index2)
  97. local RealService = RealGame:GetService(Service)
  98. local Type2 = type(Index2)
  99. if Type2 == "function" then
  100. return function (self,...) return RealService[Index2](RealService,...)end
  101. else
  102. if Index2:lower() == "localplayer" then return Sandbox(owner) end
  103. return RealService[Index2]
  104. end
  105. end;
  106. __tostring = function(self) return RealGame:GetService(Service).Name end
  107. })
  108. end;
  109. ["contextactionservice"] = function() return InternalData["ContextActionService"] end;
  110. ["userinputservice"] = function() return InternalData["UserInputService"] end;
  111. ["runservice"] = function()
  112. return setmetatable({},{
  113. __index = function(self2,Index2)
  114. local RealService = RealGame:GetService(Service)
  115. local Type2 = type(Index2)
  116. if Type2 == "function" then
  117. return function (self,...) return RealService[Index2](RealService,...) end
  118. else
  119. local RunServices = {
  120. ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return RealGame:GetService("RunService").Stepped:Connect(Function) end end;
  121. ["renderstepped"] = function() return RealService["Stepped"] end
  122. }
  123. if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end
  124. return RealService[Index2]
  125. end
  126. end
  127. })
  128. end
  129. }
  130. if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end
  131. return RealGame:GetService(Service)
  132. end
  133. end
  134. return function (self,...) return RealGame[Index](RealGame,...) end
  135. else
  136. if game:GetService(Index) then return game:GetService(Index) end
  137. return RealGame[Index]
  138. end
  139. end
  140. return nil
  141. end
  142. });Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Complete! Running...")
  143.  
  144. --MINECRAFT NOTEBLOCK BY HENLOMYDUDE--
  145.  
  146. plr = owner
  147. char = plr.Character
  148. arm = char["Left Arm"]
  149. mouse = plr:GetMouse()
  150. torso = char.Torso
  151.  
  152. --USEFUL VALUES--
  153.  
  154. CF = CFrame
  155. IT = Instance.new
  156. V3 = Vector3.new
  157. V2 = Vector2.new
  158. POS = mouse.Hit
  159.  
  160. --START CONTROLS--
  161.  
  162. placed = false
  163.  
  164. function PLACE()
  165. placed = true
  166. local noteblock = IT("Part",workspace)
  167. noteblock.Name = "noteyblock"
  168. noteblock.Position = mouse.Hit.p + Vector3.new(0, 2, 0)
  169. noteblock.Anchored = true
  170. noteblock.BrickColor = BrickColor.new("Brown")
  171. noteblock.Size = V3(4,4,4)
  172. local decal = IT("Decal",noteblock)
  173. decal.Face = "Front"
  174. decal.Texture = "http://www.roblox.com/asset/?id=59262397"
  175. local decal = IT("Decal",noteblock)
  176. decal.Face = "Back"
  177. decal.Texture = "http://www.roblox.com/asset/?id=59262397"
  178. local decal = IT("Decal",noteblock)
  179. decal.Face = "Left"
  180. decal.Texture = "http://www.roblox.com/asset/?id=59262397"
  181. local decal = IT("Decal",noteblock)
  182. decal.Face = "Right"
  183. decal.Texture = "http://www.roblox.com/asset/?id=59262397"
  184. local decal = IT("Decal",noteblock)
  185. decal.Face = "Top"
  186. decal.Texture = "http://www.roblox.com/asset/?id=59262397"
  187. local decal = IT("Decal",noteblock)
  188. decal.Face = "Bottom"
  189. decal.Texture = "http://www.roblox.com/asset/?id=59262397"
  190. local sound = IT("Sound",noteblock)
  191. sound.Playing = true
  192. sound.Looped = true
  193. sound.Volume = 10
  194. sound.SoundId = ""
  195.  
  196. local sur = Instance.new("BillboardGui", noteblock)
  197. sur.Name = "Billboard"
  198. sur.Adornee = noteblock
  199. sur.Size = UDim2.new(10, 0, 5, 0)
  200. sur.StudsOffset = Vector3.new(0, 5, 0)
  201. local text = Instance.new("TextLabel", sur)
  202. text.Text = owner.Name .."'s Note block"
  203. text.Size = UDim2.new(1, 0, 1, 0)
  204. text.TextScaled = true
  205. text.BackgroundTransparency = 1
  206. text.Font = Enum.Font.Arcade
  207. text.TextColor3 = Color3.new(1, 1, 1)
  208. text.TextStrokeTransparency = 0.5
  209.  
  210. end
  211.  
  212. mouse.Button1Down:connect(function()
  213. if placed == false then
  214. PLACE()
  215. end
  216. end)
  217.  
  218. plr.Chatted:connect(function(message)
  219. if message:sub(1,4) == "Play" then
  220. workspace.noteyblock.Sound:Stop()
  221. workspace.noteyblock.Sound.SoundId = "http://www.roblox.com/asset/?id="..message:sub(6)
  222. workspace.noteyblock.Sound:Play()
  223. end
  224. end)
  225.  
  226. plr.Chatted:connect(function(msg)
  227. msg=msg:lower()
  228. if msg == "remove" then
  229. game.Workspace.noteyblock:Destroy()
  230. placed = false
  231. end
  232. end)
  233.  
  234. disco = false
  235.  
  236. while placed do
  237. light = Instance.new("PointLight",workspace.noteyblock)
  238. light.Color = BrickColor.Random().Color
  239. light.Enabled = true
  240. light.Range = 30
  241. light.Color = BrickColor.Random().Color
  242. wait(0.5)
  243. end
  244.  
  245. warn("Made by HenloMyDude")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement