Advertisement
1nubloku

avar23r43efsd

Nov 25th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player = owner
  3. local Mouse = owner
  4. local mouse = owner
  5. local UserInputService = owner
  6. local ContextActionService = owner
  7. local RealPlayer = Player
  8. 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
  9.  
  10. msh = Instance.new("SpecialMesh",nil)
  11. msh.MeshId = "rbxassetid://116679805"
  12. msh.TextureId = "rbxassetid://116679995"
  13. msh.Scale = Vector3.new(0.02, 0.02, 0.02)
  14.  
  15. plr = owner
  16. char = plr.Character
  17. ra = char["Right Arm"]
  18. la = char["Left Arm"]
  19. rl = char["Right Leg"]
  20. ll = char["Left Leg"]
  21. root = char.HumanoidRootPart
  22. hed = char.Head
  23. tors = char.Torso
  24. hum = char.Humanoid
  25.  
  26. function ezweld(p, a, b, cf)
  27. local weld = Instance.new("Weld",p)
  28. weld.Part0 = a
  29. weld.Part1 = b
  30. weld.C0 = cf
  31. return weld
  32. end
  33.  
  34. function Swait(number)
  35. if number == 0 or number == nil then
  36. game:GetService("RunService").Heartbeat:Wait()
  37. else
  38. for i = 1,number do
  39. game:GetService("RunService").Heartbeat:Wait()
  40. end
  41. end
  42. end
  43.  
  44. clerp = function(toclerp, cf, number)
  45. local joint = toclerp
  46. joint.C0 = joint.C0:Lerp(cf, number)
  47. end
  48.  
  49. clerp2 = function(toclerp, cf)
  50. local joint = toclerp
  51. joint.C0 = cf
  52. end
  53.  
  54. clerp3 = function(toclerp, cf, number)
  55. local joint = toclerp
  56. joint.C1 = joint.C1:Lerp(cf, number)
  57. end
  58.  
  59. anim = "Idle"
  60. attack = false
  61. local RS = char.Torso["Right Shoulder"]
  62. local LS = char.Torso["Left Shoulder"]
  63. local RH = char.Torso["Right Hip"]
  64. local LH = char.Torso["Left Hip"]
  65. local neck = char.Torso["Neck"]
  66. local anim = "Idle"
  67. local root = char.HumanoidRootPart
  68. local rootj = root.RootJoint
  69. local timepos = 0
  70. local sine = 0
  71. local RSnor = RS.C0
  72. local LSnor = LS.C0
  73. local RHnor = RH.C0
  74. local LHnor = LH.C0
  75. local RSnor2 = RS.C1
  76. local LSnor2 = LS.C1
  77. local RHnor2 = RH.C1
  78. local LHnor2 = LH.C1
  79. local rootjnor = rootj.C0
  80. local necknor = neck.C0
  81. local tors = char.Torso
  82. local playstealanim = false
  83. hold = false
  84. mouse = plr:GetMouse()
  85. hold = false
  86. Debris = game:GetService("Debris")
  87.  
  88. IT = Instance.new
  89. Rad = math.rad
  90. Cos = math.cos
  91. Sin = math.sin
  92. BrickC = BrickColor.new
  93. C3 = Color3.new
  94. VT = Vector3.new
  95.  
  96. function addcontroller(part)
  97. local control1 = Instance.new("Part",char)
  98. control1.CanCollide = false
  99. control1.Anchored = false
  100. control1.Name = "controller"
  101. control1.Size = Vector3.new(0.1, 0.1, 0.1)
  102. local mesh1 = msh:Clone()
  103. mesh1.Parent = control1
  104. local weld1 = ezweld(char, part, control1, CFrame.new(0, -part.Size.y / 2.45, -0.15) * CFrame.Angles(Rad(-90), 0, 0))
  105. return control1
  106. end
  107.  
  108. local control1 = addcontroller(ra)
  109. local control2 = addcontroller(la)
  110.  
  111. --hed is Head
  112. --tors is Torso
  113. --la is Left Arm
  114. --HEADLERP is already added for u
  115.  
  116. local HEADLERP = Instance.new("ManualWeld")
  117. HEADLERP.Parent = hed
  118. HEADLERP.Part0 = hed
  119. HEADLERP.Part1 = hed
  120. HEADLERP.C0 = CFrame.new(0, -1.5, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
  121.  
  122. MseGuide = true
  123. OrgnC0 = neck.C0
  124. local movelimbs = coroutine.wrap(function()
  125. while game:GetService("RunService").RenderStepped:wait() do
  126. TrsoLV = tors.CFrame.lookVector
  127. Dist = nil
  128. Diff = nil
  129. if not MseGuide then
  130. print("Failed to recognize")
  131. else
  132. local _, Point = workspace:FindPartOnRay(Ray.new(hed.CFrame.p, mouse.Hit.lookVector), workspace, false, true)
  133. Dist = (hed.CFrame.p-Point).magnitude
  134. Diff = hed.CFrame.Y-Point.Y
  135. local _, Point2 = workspace:FindPartOnRay(Ray.new(la.CFrame.p, mouse.Hit.lookVector), workspace, false, true)
  136. Dist2 = (la.CFrame.p-Point).magnitude
  137. Diff2 = la.CFrame.Y-Point.Y
  138. HEADLERP.C0 = CFrame.new(0, -1.5, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
  139. neck.C0 = OrgnC0*CFrame.Angles((math.tan(Diff/Dist)*1.5), 0, (((hed.CFrame.p-Point).Unit):Cross(tors.CFrame.lookVector)).Y*1.5)
  140. end
  141. end
  142. end)
  143.  
  144. movelimbs()
  145.  
  146. NLS([[
  147.  
  148. function Swait(number)
  149. if number == 0 or number == nil then
  150. game:GetService("RunService").Heartbeat:Wait()
  151. else
  152. for i = 1,number do
  153. game:GetService("RunService").Heartbeat:Wait()
  154. end
  155. end
  156. end
  157.  
  158. while true do
  159. Swait()
  160. for i,v in pairs (owner.Character:GetChildren()) do
  161. if v:IsA("Part") and v.Name == "controller" then
  162. v.LocalTransparencyModifier = 0
  163. end
  164. end
  165. owner.Character["Right Arm"].LocalTransparencyModifier = 0
  166. owner.Character["Left Arm"].LocalTransparencyModifier = 0
  167. owner.Character["Right Leg"].LocalTransparencyModifier = 0
  168. owner.Character["Left Leg"].LocalTransparencyModifier = 0
  169. owner.Character["Torso"].LocalTransparencyModifier = 0
  170. end
  171.  
  172. ]],char)
  173.  
  174. Grabbing = false
  175. local CameraCFrame = CFrame.new(0, 0, 0)
  176. local PushGrabbingPart = true
  177.  
  178. local CamCFrame = Instance.new("RemoteEvent",char)
  179. CamCFrame.Name = "CamCFrame"
  180.  
  181. NLS([[
  182.  
  183. plr = owner
  184. char = plr.Character
  185. RootPart = char.HumanoidRootPart
  186. cam = workspace.CurrentCamera
  187. mu = plr:GetMouse()
  188.  
  189. while true do
  190. game:GetService("RunService").stepped:wait()
  191. char.CamCFrame:FireServer(cam.CFrame)
  192. RootPart.CFrame = CFrame.new(RootPart.Position,Vector3.new(mu.Hit.p.X,RootPart.Position.Y,mu.Hit.p.Z))
  193. end
  194.  
  195. ]],char)
  196.  
  197. CamCFrame.OnServerEvent:Connect(function(_,CAMCF)
  198. CameraCFrame = CAMCF
  199. end)
  200.  
  201. function nograv(PART)
  202. local bodyForced = Instance.new('BodyForce', PART)
  203. bodyForced.Name = 'ANTGR'
  204. bodyForced.Force = Vector3.new(0, PART:GetMass() * game.Workspace.Gravity, 0)
  205. return bodyForced
  206. end
  207.  
  208. Range = 5
  209.  
  210. function CreatePart(PARENT, MATERIAL, REFLECTANCE, TRANSPARENCY, BRICKCOLOR, NAME, SIZE, ANCHOR)
  211. local NEWPART = Instance.new("Part",PARENT)
  212. NEWPART.Reflectance = REFLECTANCE
  213. NEWPART.Transparency = TRANSPARENCY
  214. NEWPART.CanCollide = false
  215. NEWPART.Locked = true
  216. if ANCHOR == true then
  217. NEWPART.Anchored = true
  218. end
  219. NEWPART.BrickColor = BrickColor.new(BRICKCOLOR)
  220. NEWPART.Name = NAME
  221. NEWPART.Size = SIZE
  222. NEWPART.Position = tors.Position
  223. NEWPART.Material = MATERIAL
  224. return NEWPART
  225. end
  226.  
  227. local function weldBetween(a, b)
  228. local weldd = Instance.new("ManualWeld")
  229. weldd.Part0 = a
  230. weldd.Part1 = b
  231. weldd.C0 = CFrame.new()
  232. weldd.C1 = b.CFrame:inverse() * a.CFrame
  233. weldd.Parent = a
  234. return weldd
  235. end
  236.  
  237. function spawnsword(cf)
  238. local sword = Instance.new("Part",workspace)
  239. sword.Size = Vector3.new(1, 0.8, 4)
  240. sword.CFrame = cf
  241. sword.Anchored = false
  242. sword.Touched:connect(function(hit)
  243. for i,v in pairs (hit.Parent:children()) do
  244. if v:IsA("Humanoid") and v.Parent ~= char then
  245. v.Health = v.Health - 5
  246. end
  247. end
  248. end)
  249. local mesh = Instance.new("SpecialMesh",sword)
  250. mesh.MeshId = "rbxasset://fonts/sword.mesh"
  251. mesh.TextureId = "rbxasset://textures/SwordTexture.png"
  252. return sword
  253. end
  254.  
  255. function spawnsponge(cf)
  256. local sponge = Instance.new("Part",workspace)
  257. sponge.Size = Vector3.new(2.5, 1.125, 4.25)
  258. sponge.CFrame = cf
  259. sponge.Anchored = false
  260. sponge.Touched:connect(function(hit)
  261. for i,v in pairs (hit:children()) do
  262. if v:IsA("Decal") and not v:FindFirstChild("cantclean") then
  263. v.Transparency = v.Transparency + 0.05
  264. local cantclean = Instance.new("NumberValue",v)
  265. cantclean.Name = "cantclean"
  266. Debris:AddItem(cantclean, 0.25)
  267. end
  268. end
  269. end)
  270. local mesh = Instance.new("SpecialMesh",sponge)
  271. mesh.MeshId = "rbxassetid://551373055"
  272. mesh.TextureId = "rbxassetid://551373057"
  273. mesh.Scale = Vector3.new(0.1, 0.1, 0.1)
  274. return sponge
  275. end
  276.  
  277. function toasted(cf)
  278. local a = 0.0025
  279. local bread = Instance.new("Part",workspace) bread.CanCollide = true bread.Anchored = false bread.CFrame = cf bread.Size = Vector3.new(1.045, 1.015, 0.101) bread.Orientation = Vector3.new(90, 180, 0)
  280. local bmesh = Instance.new("SpecialMesh",bread) bmesh.MeshType = "FileMesh" bmesh.MeshId = "rbxassetid://1614924885" bmesh.TextureId = "rbxassetid://1614940093" bmesh.Scale = Vector3.new(a, a, a)
  281. return bread
  282. end
  283.  
  284. function grab(Tag)
  285. local GrabbingBall = CreatePart(char,"Neon",0,1,"White","GrabbingBall",VT(0.1,0.1,0.1),false)
  286. GrabbingBall.Shape = "Ball"
  287. local xs,ys,zs = CameraCFrame:ToEulerAnglesXYZ()
  288. local starterrot = CFrame.new(0,0,0) * CFrame.Angles(Rad(math.deg(xs)),Rad(math.deg(ys)),Rad(math.deg(zs)))
  289. local TagMass = Tag.Massless
  290. local OldVelocity = Tag.Velocity
  291. Tag.Velocity = VT(0,0,0)
  292. Tag.Massless = false
  293. local AntiGrav = nograv(Tag)
  294. GrabbingBall.CFrame = CFrame.new(mouse.Hit.p,hed.Position)
  295. weldBetween(GrabbingBall,Tag)
  296. nograv(GrabbingBall)
  297. repeat
  298. Swait()
  299. if Grabbing == true then
  300. GrabbingBall.Velocity = VT(0,0,0)
  301. Tag.Velocity = VT(0,0,0)
  302. GrabbingBall.RotVelocity = VT(0,0,0)
  303. Tag.RotVelocity = VT(0,0,0)
  304. local NewPos = CameraCFrame.lookVector * Range
  305. NewPos = hed.Position + NewPos
  306. GrabbingBall.CFrame = CFrame.new(NewPos,hed.Position)
  307. if Tag.Name == "shov" then
  308. game.Workspace.Terrain:FillBall(Tag.Base.Position,3.5,"Air")
  309. end
  310. if Tag.Name == "Furniture" then
  311. Tag.Anchored = false
  312. end
  313. end
  314. until Grabbing == false or PushGrabbingPart == true
  315. GrabbingBall:Destroy()
  316. AntiGrav:Destroy()
  317. Tag.Velocity = OldVelocity
  318. Tag.Massless = TagMass
  319. if PushGrabbingPart == true then
  320. Tag.Velocity = CameraCFrame.lookVector * 100
  321. PushGrabbingPart = false
  322. end
  323. end
  324.  
  325. mouse.Button2Down:Connect(function()
  326. if mouse.Target then
  327. if mouse.Target.Name ~= "Base" then
  328. if (mouse.Target.Position - hed.Position).Magnitude < 15 then
  329. Grabbing = true
  330. grab(mouse.Target)
  331. end
  332. end
  333. end
  334. end)
  335.  
  336. mouse.Button2Up:Connect(function()
  337. if Grabbing == true then
  338. Grabbing = false
  339. Range = 5
  340. end
  341. end)
  342.  
  343. mouse.KeyDown:connect(function(key)
  344. if key == "e" then
  345. spawnsword(tors.CFrame)
  346. end
  347. if key == "t" then
  348. toasted(tors.CFrame)
  349. end
  350. if key == "r" then
  351. spawnsponge(tors.CFrame)
  352. end
  353. end)
  354.  
  355. mouse.Button1Down:connect(function()
  356. PushGrabbingPart = true
  357. end)
  358.  
  359. local wld1 = ezweld(char, tors, ra, RS.C0)
  360. wld1.C1 = RS.C1
  361.  
  362. local wld2 = ezweld(char, tors, la, LS.C0)
  363. wld2.C1 = LS.C1
  364.  
  365. while true do
  366. Swait()
  367. tframe = char.Torso.CFrame
  368. taim = mouse.Hit.p -( tframe.p )
  369. wld1.C0 = CFrame.Angles(Rad(90), 0, 0) * (CFrame.new(Vector3.new(),tframe:vectorToObjectSpace(taim))*CFrame.Angles(0,math.pi/2,0))+Vector3.new( 1, 0.5, 0 ),1
  370. wld2.C0 = CFrame.Angles(Rad(90), 0, 0) * (CFrame.new(Vector3.new(),tframe:vectorToObjectSpace(taim))*CFrame.Angles(0,-math.pi/2,0))+Vector3.new( -1, 0.5, 0 ),1
  371. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement