Advertisement
BobMe

localvr - void

May 15th, 2020
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.41 KB | None | 0 0
  1. local size = 5 -- change this to change your starting size! (start with a whole number)
  2.  
  3. -- don't mind my messy, unorganized code, just focus on the beauty of the script!
  4. local VRService = game:GetService("VRService")
  5. local RunService = game:GetService("RunService")
  6. local lh = Instance.new("Part",workspace)
  7. local mode = 0
  8. lastmode = 0
  9. local maxmodes = 5
  10.  
  11. while workspace:FindFirstChild("dksfbfkhsdhbfsjhd") ~= nil do
  12. workspace:FindFirstChild("dksfbfkhsdhbfsjhd"):Destroy()
  13. end
  14.  
  15. lh.Transparency = 0
  16. lh.Size = Vector3.new(0.2,0.2,0.6) * Vector3.new(size,size,size)
  17. lh.Material = "Metal"
  18. lh.Color = Color3.fromRGB(255,100,255)
  19. lh.Name = "dksfbfkhsdhbfsjhd"
  20. lh.CanCollide = false
  21. lh.Anchored = true
  22. local rh = Instance.new("Part",workspace)
  23. rh.Transparency = 0
  24. rh.Size = Vector3.new(0.2,0.2,0.6) * Vector3.new(size,size,size)
  25. rh.Material = "Metal"
  26. rh.Name = "dksfbfkhsdhbfsjhd"
  27. rh.Color = Color3.fromRGB(255,100,255)
  28. rh.CanCollide = false
  29. rh.Anchored = true
  30. local selec1 = Instance.new("SelectionBox",lh)
  31. selec1.Color3 = Color3.fromRGB(255,0,255)
  32. selec1.LineThickness = 0.15
  33. local selec2 = Instance.new("SelectionBox",rh)
  34. selec2.Color3 = Color3.fromRGB(255,0,255)
  35. selec2.LineThickness = 0.15
  36. local he = Instance.new("Part",workspace)
  37. he.Size = Vector3.new(2,2,2) * Vector3.new(size,size,size)
  38. he.CanCollide = false
  39. he.Transparency = 1
  40. he.Anchored = true
  41. local antispamright = false
  42. local antispamleft = false
  43.  
  44. local laserrh = Instance.new("Part")
  45. laserrh.Color = Color3.fromRGB(255, 75, 230)
  46. laserrh.Name = "dksfbfkhsdhbfsjhd"
  47. laserrh.Material = "Neon"
  48. laserrh.Transparency = 1
  49. laserrh.Parent = workspace
  50. laserrh.CanCollide = false
  51. laserrh.Anchored = true
  52. local laserlh = Instance.new("Part")
  53. laserlh.Color = Color3.fromRGB(255, 75, 230)
  54. laserlh.Material = "Neon"
  55. laserlh.Transparency = 1
  56. laserlh.Name = "dksfbfkhsdhbfsjhd"
  57. laserlh.Parent = workspace
  58. laserlh.CanCollide = false
  59. laserlh.Anchored = true
  60.  
  61. game.StarterGui:SetCore("VRLaserPointerMode", 0)
  62. game.StarterGui:SetCore("VREnableControllerModels", false)
  63.  
  64. --now to wait for the server if it isn't called yet!
  65. local remote = game.Players.LocalPlayer:WaitForChild("VrC")
  66. remote:FireServer("Start",size)
  67. wait(.5)
  68. workspace:WaitForChild(game.Players.LocalPlayer.Name.."-Head").Transparency = 1
  69. selec1.Adornee = workspace:WaitForChild(game.Players.LocalPlayer.Name.."-LeftHand")
  70. selec2.Adornee = workspace:WaitForChild(game.Players.LocalPlayer.Name.."-RightHand")
  71. workspace:WaitForChild(game.Players.LocalPlayer.Name.."-LeftHand").Transparency = 1
  72. workspace:WaitForChild(game.Players.LocalPlayer.Name.."-RightHand").Transparency = 1
  73.  
  74. local function multiplyCFrame(a, b)
  75. local ax, ay, az, a11, a12, a13, a21, a22, a23, a31, a32, a33 = a:components()
  76. local bx, by, bz, b11, b12, b13, b21, b22, b23, b31, b32, b33 = b:components()
  77. local x = ax*bx
  78. local y = ay*by
  79. local z = az*bz
  80. local m11 = a11*b11
  81. local m12 = a12*b12
  82. local m13 = a13*b13
  83. local m21 = a21*b21
  84. local m22 = a22*b22
  85. local m23 = a23*b23
  86. local m31 = a31*b31
  87. local m32 = a32*b32
  88. local m33 = a33*b33
  89. return CFrame.new(x, y, z, m11, m12, m13, m21, m22, m23, m31, m32, m33)
  90. end
  91. workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
  92. workspace.CurrentCamera.CFrame = CFrame.new(0,0,0) * CFrame.new(0,5*size,0)
  93. workspace.CurrentCamera.HeadScale = size
  94.  
  95. RunService.RenderStepped:Connect(function()
  96. workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
  97. local curr = workspace.CurrentCamera.CFrame
  98. local head = (VRService:GetUserCFrame(Enum.UserCFrame.Head) * CFrame.new(0,0,0.2)) + Vector3.new(0,1.25*(4*(1-size)),0)
  99. he.CFrame = multiplyCFrame((curr * head),CFrame.new(size, size, size, 1, 1, 1, 1, 1, 1, 1, 1, 1))
  100. local lefthand = (VRService:GetUserCFrame(Enum.UserCFrame.LeftHand) * CFrame.new(0,0,0.2)) + Vector3.new(0,1.25*(4*(1-size)),0)
  101. lh.CFrame = multiplyCFrame((curr * lefthand),CFrame.new(size, size, size, 1, 1, 1, 1, 1, 1, 1, 1, 1))
  102. local righthand = (VRService:GetUserCFrame(Enum.UserCFrame.RightHand) * CFrame.new(0,0,0.2)) + Vector3.new(0,1.25*(4*(1-size)),0)
  103. rh.CFrame = multiplyCFrame((curr * righthand),CFrame.new(size, size, size, 1, 1, 1, 1, 1, 1, 1, 1, 1))
  104. lh.Size = Vector3.new(0.2,0.2,0.6) * Vector3.new(size,size,size)
  105. rh.Size = Vector3.new(0.2,0.2,0.6) * Vector3.new(size,size,size)
  106. he.Size = Vector3.new(2,2,2) * Vector3.new(size,size,size)
  107. remote:FireServer("update",{lh.CFrame,rh.CFrame,he.CFrame,size})
  108. end)
  109.  
  110. function changeMode()
  111. if mode == 0 then
  112. lh.Color = Color3.fromRGB(255,100,255)
  113. rh.Color = Color3.fromRGB(255,100,255)
  114. selec1.Color3 = Color3.fromRGB(255,0,255)
  115. selec2.Color3 = Color3.fromRGB(255,0,255)
  116. laserlh.Color = Color3.fromRGB(255, 75, 230)
  117. laserrh.Color = Color3.fromRGB(255, 75, 230)
  118. elseif mode == 1 then
  119. lh.Color = Color3.fromRGB(100,100,255)
  120. rh.Color = Color3.fromRGB(100,100,255)
  121. selec1.Color3 = Color3.fromRGB(0,0,255)
  122. selec2.Color3 = Color3.fromRGB(0,0,255)
  123. elseif mode == 2 then
  124. lh.Color = Color3.fromRGB(255,100,100)
  125. rh.Color = Color3.fromRGB(255,100,100)
  126. selec1.Color3 = Color3.fromRGB(255,0,0)
  127. selec2.Color3 = Color3.fromRGB(255,0,0)
  128. elseif mode == 3 then
  129. lh.Color = Color3.fromRGB(100,255,100)
  130. rh.Color = Color3.fromRGB(100,255,100)
  131. selec1.Color3 = Color3.fromRGB(0,255,0)
  132. selec2.Color3 = Color3.fromRGB(0,255,0)
  133. laserlh.Color = Color3.fromRGB(100,255,100)
  134. laserrh.Color = Color3.fromRGB(100,255,100)
  135. laserlh.Transparency = 0.875
  136. laserrh.Transparency = 0.875
  137. elseif mode == 4 then
  138. lh.Color = Color3.fromRGB(255,255,100)
  139. rh.Color = Color3.fromRGB(255,255,100)
  140. selec1.Color3 = Color3.fromRGB(255,255,0)
  141. selec2.Color3 = Color3.fromRGB(255,255,0)
  142. elseif mode == 5 then
  143. lh.Color = Color3.fromRGB(100,255,255)
  144. rh.Color = Color3.fromRGB(100,255,255)
  145. lh.Transparency = 0.5
  146. rh.Transparency = 0.5
  147. selec1.Color3 = Color3.fromRGB(0,255,255)
  148. selec2.Color3 = Color3.fromRGB(0,255,255)
  149. end
  150. if mode ~= 3 then
  151. laserlh.Transparency = 1
  152. laserrh.Transparency = 1
  153. end
  154. if lastmode == 5 then
  155. coroutine.resume(coroutine.create(function()
  156. lh.Transparency = 0
  157. rh.Transparency = 0
  158. wait(1)
  159. workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-LeftHand").Transparency = 1
  160. workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-RightHand").Transparency = 1
  161. workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-Head").Transparency = 1
  162. end))
  163. end
  164. remote:FireServer("mode",mode)
  165. lastmode = mode
  166. end
  167.  
  168. VRService:SetTouchpadMode(Enum.VRTouchpad.Right, Enum.VRTouchpadMode.ABXY)
  169. local UserInputService = game:GetService("UserInputService")
  170. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  171. if input.KeyCode == Enum.KeyCode.ButtonY then
  172. if size >= 1 then
  173. size = size + 1
  174. elseif size >= 10 then
  175. size = size + 2
  176. elseif size >= 50 then
  177. size = size + 5
  178. elseif size >= 200 then
  179. size = size + 20
  180. elseif size < 1 then
  181. size = size * 2
  182. end
  183. workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
  184. local bon = workspace.CurrentCamera.CFrame
  185. workspace.CurrentCamera.CFrame = CFrame.new(bon.X*-1,0,bon.Z*-1) * CFrame.new(0,5*size,0)
  186. workspace.CurrentCamera.HeadScale = size
  187. elseif input.KeyCode == Enum.KeyCode.ButtonA then
  188. if size <= 1 then
  189. size = size / 2
  190. elseif size <= 10 then
  191. size = size - 1
  192. elseif size > 10 then
  193. size = size - 2
  194. end
  195. workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
  196. local bon = workspace.CurrentCamera.CFrame
  197. workspace.CurrentCamera.CFrame = CFrame.new(bon.X*-1,0,bon.Z*-1) * CFrame.new(0,5*size,0)
  198. workspace.CurrentCamera.HeadScale = size
  199. elseif input.KeyCode == Enum.KeyCode.ButtonR2 and mode == 0 then
  200. if antispamright == false then
  201. laserrh.Transparency = 0.875
  202. local csc = remote:FireServer("chargeright")
  203. antispamright = true
  204. end
  205. elseif input.KeyCode == Enum.KeyCode.ButtonL2 and mode == 0 then
  206. if antispamleft == false then
  207. laserlh.Transparency = 0.875
  208. local csc = remote:FireServer("chargeleft")
  209. antispamleft = true
  210. end
  211. elseif input.KeyCode == Enum.KeyCode.ButtonR2 and mode == 3 then
  212. if false == false then
  213. local csc = remote
  214. local plr = game.Players.LocalPlayer
  215. local ray = Ray.new(rh.CFrame.p,(rh.CFrame.LookVector) * 1000)
  216. print(tostring(workspace:FindPartOnRayWithIgnoreList(ray, {rh,workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-RightHand")})))
  217. csc:FireServer("GrabRight",{workspace:FindPartOnRayWithIgnoreList(ray, {rh,laserrh,laserlh,workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-RightHand")})})
  218. end
  219. elseif input.KeyCode == Enum.KeyCode.ButtonL2 and mode == 3 then
  220. if false == false then
  221. local csc = remote
  222. local plr = game.Players.LocalPlayer
  223. local ray = Ray.new(lh.CFrame.p,(lh.CFrame.LookVector) * 1000)
  224. csc:FireServer("GrabLeft",{workspace:FindPartOnRayWithIgnoreList(ray, {lh,laserrh,laserlh,workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-LeftHand")})})
  225. end
  226. elseif input.KeyCode == Enum.KeyCode.ButtonL1 then
  227. if antispamleft == false and antispamright == false then
  228. --grip left
  229. mode = mode - 1
  230. if mode < 0 then
  231. mode = maxmodes
  232. end
  233. changeMode()
  234. end
  235. elseif input.KeyCode == Enum.KeyCode.ButtonR1 then
  236. if antispamleft == false and antispamright == false then
  237. --grip left
  238. mode = mode + 1
  239. if mode > maxmodes then
  240. mode = 0
  241. end
  242. changeMode()
  243. end
  244. end
  245. if size <= 2 then
  246. selec1.LineThickness = 0.15/8
  247. selec2.LineThickness = 0.15/8
  248. else
  249. selec1.LineThickness = 0.15
  250. selec2.LineThickness = 0.15
  251. end
  252. end)
  253.  
  254. UserInputService.InputEnded:Connect(function(input, gameProcessed)
  255. if input.KeyCode == Enum.KeyCode.ButtonR2 and mode == 0 then
  256. if antispamright == true then
  257. local csc = remote
  258. local plr = game.Players.LocalPlayer
  259. local tool = script.Parent
  260. local ray = Ray.new(rh.CFrame.p,(rh.CFrame.LookVector*Vector3.new(-1,-1,-1)) * 1000)
  261. csc:FireServer("ShootRight",{ray,rh.CFrame})
  262. laserrh.Transparency = 1
  263. antispamright = false
  264. end
  265. elseif input.KeyCode == Enum.KeyCode.ButtonR2 and mode == 3 then
  266. remote:FireServer("UngrabRight")
  267. elseif input.KeyCode == Enum.KeyCode.ButtonL2 and mode == 3 then
  268. remote:FireServer("UngrabLeft")
  269. elseif input.KeyCode == Enum.KeyCode.ButtonL2 and mode == 0 then
  270. if antispamleft == true then
  271. local csc = remote
  272. local plr = game.Players.LocalPlayer
  273. local tool = script.Parent
  274. local ray = Ray.new(rh.CFrame.p,(rh.CFrame.LookVector*Vector3.new(-1,-1,-1)) * 1000)
  275. csc:FireServer("ShootLeft",{ray,lh.CFrame})
  276. laserlh.Transparency = 1
  277. antispamleft = false
  278. end
  279. end
  280. end)
  281.  
  282. function chat(mod,msg)
  283. wait(.2)
  284. local bap = mod.Head:FindFirstChild('bap')
  285. if bap ~= nil then
  286. local textlabel = mod.Head.bap.TextLabel
  287. textlabel.Text = msg
  288. coroutine.resume(coroutine.create(function()
  289. wait(8)
  290. if textlabel.Text == msg then
  291. textlabel.Text = ""
  292. end
  293. end))
  294. else
  295. coroutine.resume(coroutine.create(function()
  296. local bill = Instance.new("BillboardGui",mod.Head)
  297. bill.Name = "bap"
  298. bill.LightInfluence = 0
  299. bill.Size = UDim2.new(10,0,4,0)
  300. bill.StudsOffset = Vector3.new(0,2,0)
  301. local textlabel = Instance.new("TextLabel",bill)
  302. textlabel.Size = UDim2.new(1,0,1,0)
  303. textlabel.BackgroundTransparency = 1
  304. textlabel.TextColor3 = Color3.fromRGB(255,255,255)
  305. textlabel.TextStrokeColor3 = Color3.fromRGB(0,0,0)
  306. textlabel.TextStrokeTransparency = 0
  307. textlabel.Text = msg
  308. coroutine.resume(coroutine.create(function()
  309. wait(8)
  310. if textlabel.Text == msg then
  311. textlabel.Text = ""
  312. end
  313. end))
  314. end))
  315. end
  316. end
  317. for i,v in pairs(game.Players:GetChildren()) do
  318. coroutine.resume(coroutine.create(function()
  319. v.Chatted:Connect(function(msg)
  320. chat(v.Character,msg)
  321. end)
  322. local bill = Instance.new("BillboardGui",v.Character.Head)
  323. bill.Name = "bap"
  324. bill.LightInfluence = 0
  325. bill.Size = UDim2.new(10,0,4,0)
  326. bill.StudsOffset = Vector3.new(0,2,0)
  327. local textlabel = Instance.new("TextLabel",bill)
  328. textlabel.Size = UDim2.new(1,0,1,0)
  329. textlabel.BackgroundTransparency = 1
  330. textlabel.TextColor3 = Color3.fromRGB(255,255,255)
  331. textlabel.TextStrokeColor3 = Color3.fromRGB(0,0,0)
  332. textlabel.TextStrokeTransparency = 0
  333. textlabel.Text = ""
  334. end))
  335. end
  336. game.Players.PlayerAdded:Connect(function(plr)
  337. coroutine.resume(coroutine.create(function()
  338. plr.Chatted:Connect(function(msg)
  339. chat(plr.Character,msg)
  340. end)
  341. local bill = Instance.new("BillboardGui",plr.Character.Head)
  342. bill.Name = "bap"
  343. bill.LightInfluence = 0
  344. bill.Size = UDim2.new(10,0,4,0)
  345. bill.StudsOffset = Vector3.new(0,2,0)
  346. local textlabel = Instance.new("TextLabel",bill)
  347. textlabel.Size = UDim2.new(1,0,1,0)
  348. textlabel.BackgroundTransparency = 1
  349. textlabel.TextColor3 = Color3.fromRGB(255,255,255)
  350. textlabel.TextStrokeColor3 = Color3.fromRGB(0,0,0)
  351. textlabel.TextStrokeTransparency = 0
  352. textlabel.Text = ""
  353. end))
  354. end)
  355.  
  356. coroutine.resume(coroutine.create(function()
  357. game:GetService("RunService").RenderStepped:connect(function()
  358. local plr = game.Players.LocalPlayer
  359. --righthand
  360. local ray = Ray.new(rh.CFrame.p,(rh.CFrame.LookVector) * 1000)
  361. local cf = rh.CFrame
  362. local part, position = workspace:FindPartOnRay(ray, plr.Character, false, true)
  363. local distance = ((cf.p - position)).magnitude
  364. laserrh.Size = Vector3.new((0.125*size)/4, (0.125*size)/4, distance)
  365. laserrh.CFrame = CFrame.new(cf.p, position) * CFrame.new(0, 0, -distance / 2)
  366. --lefthand
  367. local ray = Ray.new(lh.CFrame.p,(lh.CFrame.LookVector) * 1000)
  368. local cf = lh.CFrame
  369. local part, position = workspace:FindPartOnRay(ray, plr.Character, false, true)
  370. local distance = ((cf.p - position)).magnitude
  371. laserlh.Size = Vector3.new((0.125*size)/4, (0.125*size)/4, distance)
  372. laserlh.CFrame = CFrame.new(cf.p, position) * CFrame.new(0, 0, -distance / 2)
  373. if laserrh.Transparency == 1 and laserlh.Transparency == 1 then
  374. wait(.5)
  375. end
  376. end)
  377. end))
  378.  
  379. while wait(1) do
  380. if selec1.Adornee == nil then
  381. coroutine.resume(coroutine.create(function()
  382. wait(1)
  383. workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-Head").Transparency = 1
  384. selec1.Adornee = workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-LeftHand")
  385. selec2.Adornee = workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-RightHand")
  386. workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-LeftHand").Transparency = 1
  387. workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-RightHand").Transparency = 1
  388. end))
  389. end
  390. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement