Advertisement
Vzurxy

new sked vr skript

Jan 26th, 2020
2,595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.96 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.Transparency = 1
  92.             head = loadhat(v)
  93.         end
  94.     end
  95. end
  96.  
  97. --[[
  98. local an = Instance.new("Animation",workspace)
  99. an.AnimationId = "rbxassetid://31319431"
  100. char.Humanoid:LoadAnimation(an):Play()
  101. an:Remove()
  102. ]]
  103.  
  104. char.Humanoid.AnimationPlayed:connect(function(anim)
  105.     anim:Stop()
  106. end)
  107.  
  108. for i,v in pairs(char.Humanoid:GetPlayingAnimationTracks()) do
  109.     v:AdjustSpeed(0)
  110. end
  111.  
  112. local torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")
  113. torso.Anchored = true
  114. char.HumanoidRootPart.Anchored = true
  115.  
  116. --[[
  117. local function move(tool,pos)
  118.     local armcframe = char['Right Arm'].CFrame * CFrame.new(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
  119.     local cf = armcframe:toObjectSpace(pos):inverse()
  120.     tool.Parent = backpack
  121.     tool.Grip = cf
  122.     tool.Parent = char
  123. end
  124. ]]
  125.  
  126. --[[
  127. copy.Parent = workspace
  128. copy.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame
  129. --game.Players.LocalPlayer.Character = copy
  130. cam.CameraSubject = copy.Humanoid
  131. copy.Humanoid.CameraOffset = Vector3.new(0, 5.4, 0)
  132. ]]
  133.  
  134. workspace.CurrentCamera.CFrame = CFrame.new(workspace.CurrentCamera.CFrame.Position)
  135.  
  136. input.UserCFrameChanged:connect(function(part,move)
  137.     if part == Enum.UserCFrame.Head then
  138.         --move(head,cam.CFrame*move)
  139.         local rArm = char:FindFirstChild("Right Arm") or char:FindFirstChild("RightLowerArm")
  140.         local armcframe = rArm.CFrame * CFrame.new(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
  141.         local cf = armcframe:toObjectSpace(cam.CFrame*(CFrame.new(move.p*(cam.HeadScale-1))*move)):inverse()
  142.         head.Parent = backpack
  143.         head.Grip = cf
  144.         head.Parent = char
  145.     elseif part == Enum.UserCFrame.LeftHand then
  146.         --move(handL,cam.CFrame*move)
  147.         local rArm = char:FindFirstChild("Right Arm") or char:FindFirstChild("RightLowerArm")
  148.         local armcframe = rArm.CFrame * CFrame.new(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
  149.         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()
  150.         handL.Parent = backpack
  151.         handL.Grip = cf
  152.         handL.Parent = char
  153.     elseif part == Enum.UserCFrame.RightHand then
  154.         --move(handR,cam.CFrame*move)
  155.         local rArm = char:FindFirstChild("Right Arm") or char:FindFirstChild("RightLowerArm")
  156.         local armcframe = rArm.CFrame * CFrame.new(0, -1, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0)
  157.         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()
  158.         handR.Parent = backpack
  159.         handR.Grip = cf
  160.         handR.Parent = char
  161.     end
  162. end)
  163.  
  164. input.InputChanged:connect(function(key)
  165.     if key.KeyCode == Enum.KeyCode.ButtonR1 then
  166.         if key.Position.Z > 0.9 then
  167.             R1down = true
  168.         else
  169.             R1down = false
  170.         end
  171.     end
  172. end)
  173.  
  174. input.InputBegan:connect(function(key)
  175.     if key.KeyCode == Enum.KeyCode.ButtonR1 then
  176.         R1down = true
  177.     end
  178. end)
  179.  
  180. input.InputEnded:connect(function(key)
  181.     if key.KeyCode == Enum.KeyCode.ButtonR1 then
  182.         R1down = false
  183.     end
  184. end)
  185.  
  186. game:GetService("RunService").RenderStepped:connect(function()
  187.     if R1down then
  188.         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)
  189.     end
  190. end)
  191.  
  192. --[[
  193. game:GetService("RunService").RenderStepped:connect(function(step)
  194.     copy.Humanoid:MoveTo(copy.HumanoidRootPart.Position + char.Humanoid.MoveDirection * 6)
  195. end)
  196. ]]
  197.  
  198. local function bubble(plr,msg)
  199.     game:GetService("Chat"):Chat(plr.Character.Head,msg,Enum.ChatColor.White)
  200. end
  201.  
  202. if options.forcebubblechat == true then
  203.     game.Players.PlayerAdded:connect(function(plr)
  204.         plr.Chatted:connect(function(msg)
  205.             game:GetService("Chat"):Chat(plr.Character.Head,msg,Enum.ChatColor.White)
  206.         end)
  207.     end)
  208.    
  209.     for i,v in pairs(game.Players:GetPlayers()) do
  210.         v.Chatted:connect(function(msg)
  211.             game:GetService("Chat"):Chat(v.Character.Head,msg,Enum.ChatColor.White)
  212.         end)
  213.     end
  214. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement