sIendytubble

the humanoid you click turns into a MC torch

Jun 30th, 2020
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.19 KB | None | 0 0
  1.  
  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,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code V2 by Mokiros")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.Character
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local Disconnect_Function = function(this)
  12. this[1].Functions[this[2]] = nil
  13. end
  14. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15. local FakeEvent_Metatable = {__index={
  16. Connect = function(this,f)
  17. local i = tostring(math.random(0,10000))
  18. while this.Functions[i] do
  19. i = tostring(math.random(0,10000))
  20. end
  21. this.Functions[i] = f
  22. return setmetatable({this,i},Disconnect_Metatable)
  23. end
  24. }}
  25. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26. local function fakeEvent()
  27. return setmetatable({Functions={}},FakeEvent_Metatable)
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32. FakeMouse.keyUp = FakeMouse.KeyUp
  33. FakeMouse.keyDown = FakeMouse.KeyDown
  34. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37. end}
  38. --Merged 2 functions into one by checking amount of arguments
  39. CAS.UnbindAction = CAS.BindAction
  40.  
  41. --This function will trigger the events that have been :Connect()'ed
  42. local function TriggerEvent(self,ev,...)
  43. for _,f in pairs(self[ev].Functions) do
  44. f(...)
  45. end
  46. end
  47. FakeMouse.TriggerEvent = TriggerEvent
  48. UIS.TriggerEvent = TriggerEvent
  49.  
  50. --Client communication
  51. local Event = Instance.new("RemoteEvent")
  52. Event.Name = "UserInput_Event"
  53. Event.OnServerEvent:Connect(function(plr,io)
  54. if plr~=RealPlayer then return end
  55. FakeMouse.Target = io.Target
  56. FakeMouse.Hit = io.Hit
  57. if not io.isMouse then
  58. local b = io.UserInputState == Enum.UserInputState.Begin
  59. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61. end
  62. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64. end
  65. for _,t in pairs(CAS.Actions) do
  66. for _,k in pairs(t.Keys) do
  67. if k==io.KeyCode then
  68. t.Function(t.Name,io.UserInputState,io)
  69. end
  70. end
  71. end
  72. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74. end
  75. end)
  76. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77. local Mouse = owner:GetMouse()
  78. local UIS = game:GetService("UserInputService")
  79. local input = function(io,RobloxHandled)
  80. if RobloxHandled then return end
  81. --Since InputObject is a client-side instance, we create and pass table instead
  82. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83. end
  84. UIS.InputBegan:Connect(input)
  85. UIS.InputEnded:Connect(input)
  86.  
  87. local h,t
  88. --Give the server mouse data every second frame, but only if the values changed
  89. --If player is not moving their mouse, client won't fire events
  90. local HB = game:GetService("RunService").Heartbeat
  91. while true do
  92. if h~=Mouse.Hit or t~=Mouse.Target then
  93. h,t=Mouse.Hit,Mouse.Target
  94. Event:FireServer({isMouse=true,Target=t,Hit=h})
  95. end
  96. --Wait 2 frames
  97. for i=1,2 do
  98. HB:Wait()
  99. end
  100. end]==],script)
  101.  
  102. ----Sandboxed game object that allows the usage of client-side methods and services
  103. --Real game object
  104. local RealGame = game
  105.  
  106. --Metatable for fake service
  107. local FakeService_Metatable = {
  108. __index = function(self,k)
  109. local s = rawget(self,"_RealService")
  110. if s then
  111. return typeof(s[k])=="function"
  112. and function(_,...)return s[k](s,...)end or s[k]
  113. end
  114. end,
  115. __newindex = function(self,k,v)
  116. local s = rawget(self,"_RealService")
  117. if s then s[k]=v end
  118. end
  119. }
  120. local function FakeService(t,RealService)
  121. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  122. return setmetatable(t,FakeService_Metatable)
  123. end
  124.  
  125. --Fake game object
  126. local FakeGame = {
  127. GetService = function(self,s)
  128. return rawget(self,s) or RealGame:GetService(s)
  129. end,
  130. Players = FakeService({
  131. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  132. },"Players"),
  133. UserInputService = FakeService(UIS,"UserInputService"),
  134. ContextActionService = FakeService(CAS,"ContextActionService"),
  135. RunService = FakeService({
  136. _btrs = {},
  137. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  138. BindToRenderStep = function(self,name,_,fun)
  139. self._btrs[name] = self.Heartbeat:Connect(fun)
  140. end,
  141. UnbindFromRenderStep = function(self,name)
  142. self._btrs[name]:Disconnect()
  143. end,
  144. },"RunService")
  145. }
  146. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  147. FakeGame.service = FakeGame.GetService
  148. FakeService(FakeGame,game)
  149. --Changing owner to fake player object to support owner:GetMouse()
  150. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  151. end
  152. function torch(target)
  153. target:FindFirstChildOfClass("Humanoid").PlatformStand = true
  154. target.Head:ClearAllChildren()
  155. for i,v in pairs(target:GetDescendants()) do
  156. if v.ClassName == "Decal" or v.ClassName == "Texture" then
  157. v:Destroy()
  158. end
  159. end
  160. for i,v in pairs(target:GetDescendants()) do
  161. if v.ClassName == "Part" or v.ClassName == "MeshPart" then
  162. if v.Name ~= "Torso" and v.Name ~= "Head" and v.Name ~= "HumanoidRootPart" and v.Name ~= "UpperTorso" then
  163. v:Destroy()
  164. end
  165. end
  166. end
  167. for i,v in pairs(target:GetDescendants()) do
  168. if v.ClassName == "Part" or v.ClassName == "MeshPart" then
  169. if v.Name ~= "Head" then
  170. v.Size = Vector3.new(0,0,0)
  171. v.Transparency = 1
  172. v.Anchored = false
  173. --v.CFrame = mas.CFrame
  174. v.Massless = true
  175. --local cf = mas.CFrame
  176. vweld = Instance.new("Weld",v)
  177. vweld.Part0 = target.Head
  178. vweld.Part1 = v
  179. --mas.CFrame = cf
  180. end
  181. end
  182. end
  183. Part0 = target.Head
  184. Decal1 = Instance.new("Decal")
  185. Decal2 = Instance.new("Decal")
  186. Decal3 = Instance.new("Decal")
  187. Decal4 = Instance.new("Decal")
  188. Decal5 = Instance.new("Decal")
  189. Texture6 = Instance.new("Texture")
  190. BillboardGui7 = Instance.new("BillboardGui")
  191. Frame8 = Instance.new("Frame")
  192. Frame9 = Instance.new("Frame")
  193. TextLabel10 = Instance.new("TextLabel")
  194. TextLabel11 = Instance.new("TextLabel")
  195. Script12 = Instance.new("Script")
  196. --Part0.CFrame = CFrame.new(0.276227981, 17.71558, 24.3168869, 0, 0, 1, 0, 1, -0, -1, 0, 0)
  197. --Part0.Orientation = Vector3.new(0, 90, 0)
  198. --Part0.Position = Vector3.new(0.276227981, 17.71558, 24.3168869)
  199. --Part0.Rotation = Vector3.new(0, 90, 0)
  200. Part0.Color = Color3.new(0.94902, 0.952941, 0.952941)
  201. Part0.Size = Vector3.new(0.399999678, 2, 0.399999917)
  202. Part0.BackSurface = Enum.SurfaceType.Studs
  203. Part0.BrickColor = BrickColor.new("White")
  204. Part0.FrontSurface = Enum.SurfaceType.Studs
  205. Part0.LeftParamA = 0
  206. Part0.LeftParamB = 0
  207. Part0.LeftSurface = Enum.SurfaceType.Studs
  208. Part0.RightParamA = 0
  209. Part0.RightParamB = 0
  210. Part0.RightSurface = Enum.SurfaceType.Studs
  211. Part0.brickColor = BrickColor.new("White")
  212. Part0.FormFactor = Enum.FormFactor.Symmetric
  213. Part0.formFactor = Enum.FormFactor.Symmetric
  214. Decal1.Parent = Part0
  215. Decal1.Texture = "http://www.roblox.com/asset/?id=61211168"
  216. Decal1.Transparency = 0.30000001192093
  217. Decal1.Face = Enum.NormalId.Top
  218. Decal2.Parent = Part0
  219. Decal2.Texture = "http://www.roblox.com/asset/?id=61211135"
  220. Decal2.Transparency = 0.30000001192093
  221. Decal2.Face = Enum.NormalId.Right
  222. Decal3.Parent = Part0
  223. Decal3.Texture = "http://www.roblox.com/asset/?id=61211135"
  224. Decal3.Transparency = 0.30000001192093
  225. Decal3.Face = Enum.NormalId.Left
  226. Decal4.Parent = Part0
  227. Decal4.Texture = "http://www.roblox.com/asset/?id=61211135"
  228. Decal4.Transparency = 0.30000001192093
  229. Decal5.Parent = Part0
  230. Decal5.Texture = "http://www.roblox.com/asset/?id=61211135"
  231. Decal5.Transparency = 0.30000001192093
  232. Decal5.Face = Enum.NormalId.Back
  233. Texture6.Parent = Part0
  234. Texture6.Texture = "http://www.roblox.com/asset/?id=15845700"
  235. Texture6.Transparency = 0.30000001192093
  236. Texture6.Face = Enum.NormalId.Bottom
  237. Texture6.StudsPerTileU = 4
  238. Texture6.StudsPerTileV = 4
  239. BillboardGui7.Name = "NametagGui"
  240. BillboardGui7.Parent = Part0
  241. BillboardGui7.Size = UDim2.new(1.25, 0, 1, 0)
  242. BillboardGui7.StudsOffset = Vector3.new(0, 2, 0)
  243. Frame8.Parent = BillboardGui7
  244. Frame8.Position = UDim2.new(0, 0, 0, 3)
  245. Frame8.Size = UDim2.new(1, 0, 1, -6)
  246. Frame8.BackgroundColor = BrickColor.new("Black")
  247. Frame8.BackgroundColor3 = Color3.new(0.160784, 0.160784, 0.160784)
  248. Frame8.BackgroundTransparency = 0.20000000298023
  249. Frame8.BorderSizePixel = 0
  250. Frame9.Name = "SizingFrame"
  251. Frame9.Parent = Frame8
  252. Frame9.Position = UDim2.new(0, 4, 0, 4)
  253. Frame9.Size = UDim2.new(1, -8, 1, -8)
  254. Frame9.BackgroundColor = BrickColor.new("Institutional white")
  255. Frame9.BackgroundColor3 = Color3.new(1, 1, 1)
  256. Frame9.BackgroundTransparency = 1
  257. Frame9.BorderSizePixel = 0
  258. TextLabel10.Name = "TextShadow"
  259. TextLabel10.Parent = Frame9
  260. TextLabel10.Position = UDim2.new(0, 2, 0, 2)
  261. TextLabel10.Size = UDim2.new(1, 0, 1, 0)
  262. TextLabel10.BackgroundTransparency = 1
  263. TextLabel10.BorderSizePixel = 0
  264. TextLabel10.Text = "Torch"
  265. TextLabel10.TextColor = BrickColor.new("Really black")
  266. TextLabel10.TextColor3 = Color3.new(0, 0, 0)
  267. TextLabel10.TextScaled = true
  268. TextLabel10.TextWrap = true
  269. TextLabel10.TextWrapped = true
  270. TextLabel11.Name = "NormalText"
  271. TextLabel11.Parent = TextLabel10
  272. TextLabel11.Position = UDim2.new(0, -2, 0, -2)
  273. TextLabel11.Size = UDim2.new(1, 0, 1, 0)
  274. TextLabel11.BackgroundTransparency = 1
  275. TextLabel11.BorderSizePixel = 0
  276. TextLabel11.Text = "Torch"
  277. TextLabel11.TextColor = BrickColor.new("Institutional white")
  278. TextLabel11.TextColor3 = Color3.new(1, 1, 1)
  279. TextLabel11.TextScaled = true
  280. TextLabel11.TextWrap = true
  281. TextLabel11.TextWrapped = true
  282. Script12.Name = "NametagScript"
  283. Script12.Parent = BillboardGui7
  284. end
  285. mouse = game.Players.LocalPlayer:GetMouse()
  286. mouse.Button1Down:Connect(function()
  287. if mouse.Target.Parent:FindFirstChildOfClass("Humanoid") then
  288. torch(mouse.Target.Parent)
  289. end
  290. end)
Add Comment
Please, Sign In to add comment