Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2020
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.07 KB | None | 0 0
  1. --[[
  2. _
  3. | |
  4. __ ___ __ __ _ _ __ _ ___ _| |__ ___ _ __ ___
  5. \ \ / / '__| / _` | '_ \| | | \ \ /\ / / '_ \ / _ \ '__/ _ \
  6. \ V /| | | (_| | | | | |_| |\ V V /| | | | __/ | | __/
  7. \_/ |_| \__,_|_| |_|\__, | \_/\_/ |_| |_|\___|_| \___|
  8. __/ |
  9. |___/
  10.  
  11. _ _ _
  12. | | | | | |
  13. | |__ _ _ ___| | _____ __| |
  14. | '_ \| | | | / __| |/ / _ \/ _` |
  15. | |_) | |_| | \__ \ < __/ (_| |
  16. |_.__/ \__, | |___/_|\_\___|\__,_|
  17. __/ |
  18. |___/
  19.  
  20. ]]
  21.  
  22. local options = {}
  23.  
  24. -- OPTIONS:
  25.  
  26. options.headhat = "MediHood" -- name of the accessory which you are using as a head
  27. options.headscale = 3 -- how big you are in vr, 1 is default, 3 is recommended for max comfort in vr
  28. options.forcebubblechat = true -- decide if to force bubblechat so you can see peoples messages
  29.  
  30. options.righthandhat = "Pal Hair"
  31. options.lefthandhat = "LavanderHair"
  32.  
  33. options.righthandrotoffset = Vector3.new(0,0,0)
  34. options.lefthandrotoffset = Vector3.new(0,0,0)
  35.  
  36. --
  37.  
  38. local plr = game:GetService("Players").LocalPlayer
  39. local char = plr.Character
  40. local backpack = plr.Backpack
  41.  
  42. local VR = game:GetService("VRService")
  43. local input = game:GetService("UserInputService")
  44.  
  45. local cam = workspace.CurrentCamera
  46.  
  47. cam.CameraType = "Scriptable"
  48.  
  49. cam.HeadScale = options.headscale
  50.  
  51. game:GetService("StarterGui"):SetCore("VRLaserPointerMode", 0)
  52. game:GetService("StarterGui"):SetCore("VREnableControllerModels", false)
  53.  
  54. local handL
  55. local handR
  56. local head
  57. local R1down = false
  58.  
  59. --local copy = game:GetObjects('rbxassetid://4469710589')[1]
  60. --local copy = game:GetService("InsertService"):LoadAsset(4469710589):GetChildren()[1]
  61. --local copy = game.ReplicatedStorage.Dummy:Clone()
  62.  
  63. local function loadhat(hat)
  64. local tool = Instance.new("Tool")
  65. local handle = hat.Handle
  66.  
  67. handle:FindFirstChildOfClass("Weld"):Destroy()
  68. handle.Massless = true
  69. handle.Parent = tool
  70.  
  71. tool.Name = hat.Name
  72. tool.Parent = backpack
  73. tool.Parent = char
  74.  
  75. return tool
  76. end
  77.  
  78. for i,v in pairs(char.Humanoid:GetAccessories()) do
  79. if v:FindFirstChild("Handle") then
  80. --local tool = Instance.new("Tool")
  81. --tool.Name = v.Name..i
  82. local handle = v.Handle
  83.  
  84. if v.Name == options.righthandhat and not handR then
  85. handle:FindFirstChildOfClass("SpecialMesh"):Destroy()
  86. handR = loadhat(v)
  87. elseif v.Name == options.lefthandhat and not handL then
  88. handle:FindFirstChildOfClass("SpecialMesh"):Destroy()
  89. handL = loadhat(v)
  90. elseif v.Name == options.headhat and not head then
  91. handle:FindFirstChildOfClass("SpecialMesh"):Destroy()
  92. local bruh.Instance.new ("Mesh",handle)
  93. bruh.MeshType = Head
  94. head = loadhat(v)
  95. end
  96. end
  97. end
  98.  
  99. --[[
  100. local an = Instance.new("Animation",workspace)
  101. an.AnimationId = "rbxassetid://31319431"
  102. char.Humanoid:LoadAnimation(an):Play()
  103. an:Remove()
  104. ]]
  105.  
  106. char.Humanoid.AnimationPlayed:connect(function(anim)
  107. anim:Stop()
  108. end)
  109.  
  110. for i,v in pairs(char.Humanoid:GetPlayingAnimationTracks()) do
  111. v:AdjustSpeed(0)
  112. end
  113.  
  114. local torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")
  115. torso.Anchored = true
  116. char.HumanoidRootPart.Anchored = true
  117.  
  118. --[[
  119. local function move(tool,pos)
  120. local armcframe = char['Right Arm'].CFrame * CFrame.new(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
  121. local cf = armcframe:toObjectSpace(pos):inverse()
  122. tool.Parent = backpack
  123. tool.Grip = cf
  124. tool.Parent = char
  125. end
  126. ]]
  127.  
  128. --[[
  129. copy.Parent = workspace
  130. copy.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame
  131. --game.Players.LocalPlayer.Character = copy
  132. cam.CameraSubject = copy.Humanoid
  133. copy.Humanoid.CameraOffset = Vector3.new(0, 5.4, 0)
  134. ]]
  135.  
  136. workspace.CurrentCamera.CFrame = CFrame.new(workspace.CurrentCamera.CFrame.Position)
  137.  
  138. input.UserCFrameChanged:connect(function(part,move)
  139. if part == Enum.UserCFrame.Head then
  140. --move(head,cam.CFrame*move)
  141. local rArm = char:FindFirstChild("Right Arm") or char:FindFirstChild("RightLowerArm")
  142. local armcframe = rArm.CFrame * CFrame.new(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
  143. local cf = armcframe:toObjectSpace(cam.CFrame*(CFrame.new(move.p*(cam.HeadScale-1))*move)):inverse()
  144. head.Parent = backpack
  145. head.Grip = cf
  146. head.Parent = char
  147. elseif part == Enum.UserCFrame.LeftHand then
  148. --move(handL,cam.CFrame*move)
  149. local rArm = char:FindFirstChild("Right Arm") or char:FindFirstChild("RightLowerArm")
  150. local armcframe = rArm.CFrame * CFrame.new(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
  151. local cf = armcframe:toObjectSpace(cam.CFrame*(CFrame.new(move.p*(cam.HeadScale-1))*move*CFrame.Angles(math.rad(options.righthandrotoffset.X),math.rad(options.righthandrotoffset.Y),math.rad(options.righthandrotoffset.Z)))):inverse()
  152. handL.Parent = backpack
  153. handL.Grip = cf
  154. handL.Parent = char
  155. elseif part == Enum.UserCFrame.RightHand then
  156. --move(handR,cam.CFrame*move)
  157. local rArm = char:FindFirstChild("Right Arm") or char:FindFirstChild("RightLowerArm")
  158. local armcframe = rArm.CFrame * CFrame.new(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
  159. local cf = armcframe:toObjectSpace(cam.CFrame*(CFrame.new(move.p*(cam.HeadScale-1))*move*CFrame.Angles(math.rad(options.righthandrotoffset.X),math.rad(options.righthandrotoffset.Y),math.rad(options.righthandrotoffset.Z)))):inverse()
  160. handR.Parent = backpack
  161. handR.Grip = cf
  162. handR.Parent = char
  163. end
  164. end)
  165.  
  166. input.InputChanged:connect(function(key)
  167. if key.KeyCode == Enum.KeyCode.ButtonR1 then
  168. if key.Position.Z > 0.9 then
  169. R1down = true
  170. else
  171. R1down = false
  172. end
  173. end
  174. end)
  175.  
  176. input.InputBegan:connect(function(key)
  177. if key.KeyCode == Enum.KeyCode.ButtonR1 then
  178. R1down = true
  179. end
  180. end)
  181.  
  182. input.InputEnded:connect(function(key)
  183. if key.KeyCode == Enum.KeyCode.ButtonR1 then
  184. R1down = false
  185. end
  186. end)
  187.  
  188. game:GetService("RunService").RenderStepped:connect(function()
  189. if R1down then
  190. cam.CFrame = cam.CFrame:Lerp(cam.CoordinateFrame + (handR.Handle.CFrame*CFrame.Angles(-math.rad(options.righthandrotoffset.X),-math.rad(options.righthandrotoffset.Y),math.rad(180-options.righthandrotoffset.X))).LookVector * cam.HeadScale/2, 0.5)
  191. end
  192. end)
  193.  
  194. --[[
  195. game:GetService("RunService").RenderStepped:connect(function(step)
  196. copy.Humanoid:MoveTo(copy.HumanoidRootPart.Position + char.Humanoid.MoveDirection * 6)
  197. end)
  198. ]]
  199.  
  200. local function bubble(plr,msg)
  201. game:GetService("Chat"):Chat(plr.Character.Head,msg,Enum.ChatColor.White)
  202. end
  203.  
  204. if options.forcebubblechat == true then
  205. game.Players.PlayerAdded:connect(function(plr)
  206. plr.Chatted:connect(function(msg)
  207. game:GetService("Chat"):Chat(plr.Character.Head,msg,Enum.ChatColor.White)
  208. end)
  209. end)
  210.  
  211. for i,v in pairs(game.Players:GetPlayers()) do
  212. v.Chatted:connect(function(msg)
  213. game:GetService("Chat"):Chat(v.Character.Head,msg,Enum.ChatColor.White)
  214. end)
  215. end
  216. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement