Advertisement
sIendytubble

FE vr remake (R6)

May 23rd, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.61 KB | None | 0 0
  1. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  2. local RealPlayer = Player
  3. 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 warn'controls R = point right arm towards mouse L = point left arm towards mouse IT MAY BUG BECAUSE SOMETIMES THE LIMBS THE GLUE/BallSocketConstraint MAY DESTROY THE LIMB AFTER SOME TIME. I MIGHT OF FIXED IT THOUGH I CHANGED Glue TO BallSocketConstraint it could not be fixed though.'
  4. --controls
  5. --R = point right arm towards mouse
  6. --L = point left arm towards mouse
  7. --IT MAY BUG BECAUSE SOMETIMES THE LIMBS THE GLUE/BallSocketConstraint MAY DESTROY THE LIMB AFTER SOME TIME.
  8. -- I MIGHT OF FIXED IT THOUGH
  9. -- I CHANGED Glue TO BallSocketConstraint
  10. -- it could not be fixed though.
  11.  
  12. ragdoll = owner.Character
  13. c = ragdoll
  14. player = ragdoll
  15. local RealTorso = player.Torso
  16. local RealHead = player.Head
  17. local RealLeftleg = player["Left Leg"]
  18. local RealRightleg = player["Right Leg"]
  19. local RealLeftArm = player["Left Arm"]
  20. local RealRightArm = player["Right Arm"]
  21. ragdoll.Humanoid.BreakJointsOnDeath = false
  22. -- head --
  23. ok = Instance.new("Attachment",ragdoll.Torso)
  24. ok.Position = Vector3.new(0,1,0)
  25. ok2 = Instance.new("Attachment",ragdoll.Head)
  26. ok2.Position = Vector3.new(0,-0.5,0)
  27. local headglue = Instance.new("BallSocketConstraint", RealTorso)
  28. headglue.Attachment0 = ok
  29. headglue.Attachment1 = ok2
  30. -- left arm --
  31. ok3 = Instance.new("Attachment",RealTorso)
  32. ok3.Position = Vector3.new(-1.5, 0.5, 0)
  33. ok4 = Instance.new("Attachment",RealLeftArm)
  34. ok4.Position = Vector3.new(0, 0.5, 0)
  35. local leftarmglue = Instance.new("BallSocketConstraint", RealTorso)
  36. leftarmglue.Attachment0 = ok3
  37. leftarmglue.Attachment1 = ok4
  38. leftarmglue.Name = "rightlegglue"
  39. -- right arm --
  40. ok5 = Instance.new("Attachment",RealTorso)
  41. ok5.Position = Vector3.new(1.5, 0.5, 0)
  42. ok6 = Instance.new("Attachment",RealRightArm)
  43. ok6.Position = Vector3.new(0, 0.5, 0)
  44. local rightarmglue = Instance.new("BallSocketConstraint", RealTorso)
  45. rightarmglue.Attachment0 = ok5
  46. rightarmglue.Attachment1 = ok6
  47. rightarmglue.Name = "rightarmglue"
  48. -- left leg --
  49. ok7 = Instance.new("Attachment",RealTorso)
  50. ok7.Position = Vector3.new(-0.5, -1, 0)
  51. ok8 = Instance.new("Attachment",RealLeftleg)
  52. ok8.Position = Vector3.new(0, 1, 0)
  53. local leftlegglue = Instance.new("BallSocketConstraint", RealTorso)
  54. leftlegglue.Attachment0 = ok7
  55. leftlegglue.Attachment1 = ok8
  56. leftlegglue.Name = "leftlegglue"
  57. -- right leg --
  58. ok9 = Instance.new("Attachment",RealTorso)
  59. ok9.Position = Vector3.new(0.5, -1, 0)
  60. ok10 = Instance.new("Attachment",RealRightleg)
  61. ok10.Position = Vector3.new(0, 1, 0)
  62. local rightlegglue = Instance.new("BallSocketConstraint", RealTorso)
  63. rightlegglue.Attachment0 = ok9
  64. rightlegglue.Attachment1 = ok10
  65. rightlegglue.Name = "rightlegglue"
  66. RealTorso["Left Hip"]:Destroy()
  67. RealTorso["Right Hip"]:Destroy()
  68. RealTorso["Left Shoulder"]:Destroy()
  69. RealTorso["Right Shoulder"]:Destroy()
  70. RealTorso.Neck.Part0 = nil
  71. mouse = owner:GetMouse()
  72. char = ragdoll
  73. local camPart2 = Instance.new("Part", char)
  74. camPart2.Size = Vector3.new(0, 0, 0)
  75. camPart2.CanCollide = false
  76. camPart2.Anchored = true
  77. camPart2.Transparency = 1
  78. local camPart = Instance.new("Part", char)
  79. camPart.Size = Vector3.new(0, 0, 0)
  80. camPart.CFrame = CFrame.new(char.Head.Position, camPart2.Position) * CFrame.Angles(0,math.rad(180),0)
  81. camPart.CanCollide = false
  82. camPart.Anchored = true
  83. camPart.Transparency = 1
  84. local camPart3 = Instance.new("Part", char)
  85. camPart3.Size = Vector3.new(0, 0, 0)
  86. camPart3.Position = mouse.Hit.p
  87. camPart3.CanCollide = false
  88. camPart3.Anchored = true
  89. camPart3.Transparency = 1
  90. bodygyroxd = Instance.new("BodyGyro",char.Head)
  91. bodygyroxd.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  92. armvector = Instance.new("BodyGyro",RealRightArm)
  93. armvector.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  94. armvector2 = Instance.new("BodyGyro",RealLeftArm)
  95. armvector2.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  96. local pos = nil
  97. local pos2 = nil
  98. rpointer = false
  99. lpointer = false
  100. mouse.KeyDown:Connect(function(key)
  101. if key == "r" then
  102. rpointer = true
  103. end
  104. end)
  105. mouse.KeyUp:Connect(function(key)
  106. if key == "r" then
  107. rpointer = false
  108. end
  109. end)
  110. mouse.KeyUp:Connect(function(key)
  111. if key == "l" then
  112. lpointer = false
  113. end
  114. end)
  115. mouse.KeyDown:Connect(function(key)
  116. if key == "l" then
  117. lpointer = true
  118. end
  119. end)
  120. remote = Instance.new("RemoteEvent",char)
  121. remote.Name = "neckeventxd"
  122. remote.OnServerEvent:connect(function(player, ok)
  123. camPart2.CFrame = ok
  124. end)
  125. NLS([[
  126. player = owner
  127. char = player.Character
  128. remote = char:FindFirstChild("neckeventxd")
  129. camera = workspace.CurrentCamera
  130. game:GetService("RunService").RenderStepped:Connect(function()
  131. if owner.Character:WaitForChild("neckeventxd") then
  132. owner.Character.neckeventxd:FireServer(camera.CFrame)
  133. end
  134. end)
  135. ]],owner.Character)
  136. game:GetService("RunService").RenderStepped:Connect(function()
  137. camPart3.Position = mouse.Hit.p
  138. camPart.CFrame = CFrame.new(char.Head.Position, camPart2.Position) * CFrame.Angles(0,math.rad(180),0)
  139. pos = camPart.Position
  140. pos2 = camPart3.Position
  141. bodygyroxd.CFrame = camPart.CFrame
  142. if rpointer == true then
  143. armvector.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  144. else
  145. armvector.MaxTorque = Vector3.new(0,0,0)
  146. end
  147. if lpointer == true then
  148. armvector2.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  149. else
  150. armvector2.MaxTorque = Vector3.new(0,0,0)
  151. end
  152. armvector.CFrame = CFrame.new(armvector.Parent.Position,camPart3.Position) * CFrame.Angles(math.rad(90),0,0)
  153. armvector2.CFrame = CFrame.new(armvector.Parent.Position,camPart3.Position) * CFrame.Angles(math.rad(90),0,0)
  154. end)
  155. char["Right Arm"].LocalTransparencyModifier = 0
  156. char["Left Arm"].LocalTransparencyModifier = 0
  157. while game:GetService('RunService').RenderStepped:wait() do
  158. char['Left Arm'].LocalTransparencyModifier = 0
  159. char['Right Arm'].LocalTransparencyModifier = 0
  160. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement