Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player = owner
- local Mouse = owner
- local mouse = owner
- local UserInputService = owner
- local ContextActionService = owner
- local RealPlayer = Player
- 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
- msh = Instance.new("SpecialMesh",nil)
- msh.MeshId = "rbxassetid://1532314169"
- msh.TextureId = "rbxassetid://1532316153"
- msh.Scale = Vector3.new(0.02, 0.02, 0.02)
- plr = owner
- char = plr.Character
- ra = char["Right Arm"]
- la = char["Left Arm"]
- rl = char["Right Leg"]
- ll = char["Left Leg"]
- root = char.HumanoidRootPart
- hed = char.Head
- tors = char.Torso
- hum = char.Humanoid
- function ezweld(p, a, b, cf)
- local weld = Instance.new("Weld",p)
- weld.Part0 = a
- weld.Part1 = b
- weld.C0 = cf
- return weld
- end
- function Swait(number)
- if number == 0 or number == nil then
- game:GetService("RunService").Heartbeat:Wait()
- else
- for i = 1,number do
- game:GetService("RunService").Heartbeat:Wait()
- end
- end
- end
- clerp = function(toclerp, cf, number)
- local joint = toclerp
- joint.C0 = joint.C0:Lerp(cf, number)
- end
- clerp2 = function(toclerp, cf)
- local joint = toclerp
- joint.C0 = cf
- end
- clerp3 = function(toclerp, cf, number)
- local joint = toclerp
- joint.C1 = joint.C1:Lerp(cf, number)
- end
- anim = "Idle"
- attack = false
- local RS = char.Torso["Right Shoulder"]
- local LS = char.Torso["Left Shoulder"]
- local RH = char.Torso["Right Hip"]
- local LH = char.Torso["Left Hip"]
- local neck = char.Torso["Neck"]
- local anim = "Idle"
- local root = char.HumanoidRootPart
- local rootj = root.RootJoint
- local timepos = 0
- local sine = 0
- local RSnor = RS.C0
- local LSnor = LS.C0
- local RHnor = RH.C0
- local LHnor = LH.C0
- local RSnor2 = RS.C1
- local LSnor2 = LS.C1
- local RHnor2 = RH.C1
- local LHnor2 = LH.C1
- local rootjnor = rootj.C0
- local necknor = neck.C0
- local tors = char.Torso
- local playstealanim = false
- hold = false
- mouse = plr:GetMouse()
- hold = false
- Debris = game:GetService("Debris")
- IT = Instance.new
- Rad = math.rad
- Cos = math.cos
- Sin = math.sin
- BrickC = BrickColor.new
- C3 = Color3.new
- VT = Vector3.new
- function addcontroller(part)
- local control1 = Instance.new("Part",char)
- control1.CanCollide = false
- control1.Anchored = false
- control1.Name = "controller"
- control1.Size = Vector3.new(0.1, 0.1, 0.1)
- local mesh1 = msh:Clone()
- mesh1.Parent = control1
- local weld1 = ezweld(char, part, control1, CFrame.new(0, -part.Size.y / 2.45, -0.15) * CFrame.Angles(Rad(-90), 0, 0))
- return control1
- end
- local control1 = addcontroller(ra)
- local control2 = addcontroller(la)
- --hed is Head
- --tors is Torso
- --la is Left Arm
- --HEADLERP is already added for u
- local HEADLERP = Instance.new("ManualWeld")
- HEADLERP.Parent = hed
- HEADLERP.Part0 = hed
- HEADLERP.Part1 = hed
- HEADLERP.C0 = CFrame.new(0, -1.5, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
- MseGuide = true
- OrgnC0 = neck.C0
- local movelimbs = coroutine.wrap(function()
- while game:GetService("RunService").RenderStepped:wait() do
- TrsoLV = tors.CFrame.lookVector
- Dist = nil
- Diff = nil
- if not MseGuide then
- print("Failed to recognize")
- else
- local _, Point = workspace:FindPartOnRay(Ray.new(hed.CFrame.p, mouse.Hit.lookVector), workspace, false, true)
- Dist = (hed.CFrame.p-Point).magnitude
- Diff = hed.CFrame.Y-Point.Y
- local _, Point2 = workspace:FindPartOnRay(Ray.new(la.CFrame.p, mouse.Hit.lookVector), workspace, false, true)
- Dist2 = (la.CFrame.p-Point).magnitude
- Diff2 = la.CFrame.Y-Point.Y
- HEADLERP.C0 = CFrame.new(0, -1.5, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0))
- neck.C0 = OrgnC0*CFrame.Angles((math.tan(Diff/Dist)*1.5), 0, (((hed.CFrame.p-Point).Unit):Cross(tors.CFrame.lookVector)).Y*1.5)
- end
- end
- end)
- movelimbs()
- NLS([[
- function Swait(number)
- if number == 0 or number == nil then
- game:GetService("RunService").Heartbeat:Wait()
- else
- for i = 1,number do
- game:GetService("RunService").Heartbeat:Wait()
- end
- end
- end
- while true do
- Swait()
- for i,v in pairs (owner.Character:GetChildren()) do
- if v:IsA("Part") and v.Name == "controller" then
- v.LocalTransparencyModifier = 0
- end
- end
- owner.Character["Right Arm"].LocalTransparencyModifier = 0
- owner.Character["Left Arm"].LocalTransparencyModifier = 0
- owner.Character["Right Leg"].LocalTransparencyModifier = 0
- owner.Character["Left Leg"].LocalTransparencyModifier = 0
- owner.Character["Torso"].LocalTransparencyModifier = 0
- end
- ]],char)
- Grabbing = false
- local CameraCFrame = CFrame.new(0, 0, 0)
- local PushGrabbingPart = true
- local CamCFrame = Instance.new("RemoteEvent",char)
- CamCFrame.Name = "CamCFrame"
- NLS([[
- plr = owner
- char = plr.Character
- RootPart = char.HumanoidRootPart
- cam = workspace.CurrentCamera
- mu = plr:GetMouse()
- while true do
- game:GetService("RunService").stepped:wait()
- char.CamCFrame:FireServer(cam.CFrame)
- RootPart.CFrame = CFrame.new(RootPart.Position,Vector3.new(mu.Hit.p.X,RootPart.Position.Y,mu.Hit.p.Z))
- end
- ]],char)
- CamCFrame.OnServerEvent:Connect(function(_,CAMCF)
- CameraCFrame = CAMCF
- end)
- function nograv(PART)
- local bodyForced = Instance.new('BodyForce', PART)
- bodyForced.Name = 'ANTGR'
- bodyForced.Force = Vector3.new(0, PART:GetMass() * game.Workspace.Gravity, 0)
- return bodyForced
- end
- Range = 5
- function CreatePart(PARENT, MATERIAL, REFLECTANCE, TRANSPARENCY, BRICKCOLOR, NAME, SIZE, ANCHOR)
- local NEWPART = Instance.new("Part",PARENT)
- NEWPART.Reflectance = REFLECTANCE
- NEWPART.Transparency = TRANSPARENCY
- NEWPART.CanCollide = false
- NEWPART.Locked = true
- if ANCHOR == true then
- NEWPART.Anchored = true
- end
- NEWPART.BrickColor = BrickColor.new(BRICKCOLOR)
- NEWPART.Name = NAME
- NEWPART.Size = SIZE
- NEWPART.Position = tors.Position
- NEWPART.Material = MATERIAL
- return NEWPART
- end
- local function weldBetween(a, b)
- local weldd = Instance.new("ManualWeld")
- weldd.Part0 = a
- weldd.Part1 = b
- weldd.C0 = CFrame.new()
- weldd.C1 = b.CFrame:inverse() * a.CFrame
- weldd.Parent = a
- return weldd
- end
- function spawnsword(cf)
- local sword = Instance.new("Part",workspace)
- sword.Size = Vector3.new(1, 0.8, 4)
- sword.CFrame = cf
- sword.Anchored = false
- sword.Touched:connect(function(hit)
- for i,v in pairs (hit.Parent:children()) do
- if v:IsA("Humanoid") and v.Parent ~= char then
- v.Health = v.Health - 5
- end
- end
- end)
- local mesh = Instance.new("SpecialMesh",sword)
- mesh.MeshId = "rbxasset://fonts/sword.mesh"
- mesh.TextureId = "rbxasset://textures/SwordTexture.png"
- return sword
- end
- function spawnsponge(cf)
- local sponge = Instance.new("Part",workspace)
- sponge.Size = Vector3.new(2.5, 1.125, 4.25)
- sponge.CFrame = cf
- sponge.Anchored = false
- sponge.Touched:connect(function(hit)
- for i,v in pairs (hit:children()) do
- if v:IsA("Decal") and not v:FindFirstChild("cantclean") then
- v.Transparency = v.Transparency + 0.05
- local cantclean = Instance.new("NumberValue",v)
- cantclean.Name = "cantclean"
- Debris:AddItem(cantclean, 0.25)
- end
- end
- end)
- local mesh = Instance.new("SpecialMesh",sponge)
- mesh.MeshId = "rbxassetid://551373055"
- mesh.TextureId = "rbxassetid://551373057"
- mesh.Scale = Vector3.new(0.1, 0.1, 0.1)
- return sponge
- end
- function toasted(cf)
- local a = 0.0025
- 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)
- local bmesh = Instance.new("SpecialMesh",bread) bmesh.MeshType = "FileMesh" bmesh.MeshId = "rbxassetid://1614924885" bmesh.TextureId = "rbxassetid://1614940093" bmesh.Scale = Vector3.new(a, a, a)
- return bread
- end
- function grab(Tag)
- local GrabbingBall = CreatePart(char,"Neon",0,1,"White","GrabbingBall",VT(0.1,0.1,0.1),false)
- GrabbingBall.Shape = "Ball"
- local xs,ys,zs = CameraCFrame:ToEulerAnglesXYZ()
- local starterrot = CFrame.new(0,0,0) * CFrame.Angles(Rad(math.deg(xs)),Rad(math.deg(ys)),Rad(math.deg(zs)))
- local TagMass = Tag.Massless
- local OldVelocity = Tag.Velocity
- Tag.Velocity = VT(0,0,0)
- Tag.Massless = false
- local AntiGrav = nograv(Tag)
- GrabbingBall.CFrame = CFrame.new(mouse.Hit.p,hed.Position)
- weldBetween(GrabbingBall,Tag)
- nograv(GrabbingBall)
- repeat
- Swait()
- if Grabbing == true then
- GrabbingBall.Velocity = VT(0,0,0)
- Tag.Velocity = VT(0,0,0)
- GrabbingBall.RotVelocity = VT(0,0,0)
- Tag.RotVelocity = VT(0,0,0)
- local NewPos = CameraCFrame.lookVector * Range
- NewPos = hed.Position + NewPos
- GrabbingBall.CFrame = CFrame.new(NewPos,hed.Position)
- if Tag.Name == "shov" then
- game.Workspace.Terrain:FillBall(Tag.Base.Position,3.5,"Air")
- end
- if Tag.Name == "Furniture" then
- Tag.Anchored = false
- end
- end
- until Grabbing == false or PushGrabbingPart == true
- GrabbingBall:Destroy()
- AntiGrav:Destroy()
- Tag.Velocity = OldVelocity
- Tag.Massless = TagMass
- if PushGrabbingPart == true then
- Tag.Velocity = CameraCFrame.lookVector * 100
- PushGrabbingPart = false
- end
- end
- mouse.Button2Down:Connect(function()
- if mouse.Target then
- if mouse.Target.Name ~= "Base" then
- if (mouse.Target.Position - hed.Position).Magnitude < 15 then
- Grabbing = true
- grab(mouse.Target)
- end
- end
- end
- end)
- mouse.Button2Up:Connect(function()
- if Grabbing == true then
- Grabbing = false
- Range = 5
- end
- end)
- mouse.KeyDown:connect(function(key)
- if key == "e" then
- spawnsword(tors.CFrame)
- end
- if key == "t" then
- toasted(tors.CFrame)
- end
- if key == "r" then
- spawnsponge(tors.CFrame)
- end
- end)
- mouse.Button1Down:connect(function()
- PushGrabbingPart = true
- end)
- local wld1 = ezweld(char, tors, ra, RS.C0)
- wld1.C1 = RS.C1
- local wld2 = ezweld(char, tors, la, LS.C0)
- wld2.C1 = LS.C1
- while true do
- Swait()
- tframe = char.Torso.CFrame
- taim = mouse.Hit.p -( tframe.p )
- 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
- 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
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement