Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local size = 5 -- change this to change your starting size! (start with a whole number)
- -- don't mind my messy, unorganized code, just focus on the beauty of the script!
- local VRService = game:GetService("VRService")
- local RunService = game:GetService("RunService")
- local lh = Instance.new("Part",workspace)
- local mode = 0
- lastmode = 0
- local maxmodes = 5
- while workspace:FindFirstChild("dksfbfkhsdhbfsjhd") ~= nil do
- workspace:FindFirstChild("dksfbfkhsdhbfsjhd"):Destroy()
- end
- lh.Transparency = 0
- lh.Size = Vector3.new(0.2,0.2,0.6) * Vector3.new(size,size,size)
- lh.Material = "Metal"
- lh.Color = Color3.fromRGB(255,100,255)
- lh.Name = "dksfbfkhsdhbfsjhd"
- lh.CanCollide = false
- lh.Anchored = true
- local rh = Instance.new("Part",workspace)
- rh.Transparency = 0
- rh.Size = Vector3.new(0.2,0.2,0.6) * Vector3.new(size,size,size)
- rh.Material = "Metal"
- rh.Name = "dksfbfkhsdhbfsjhd"
- rh.Color = Color3.fromRGB(255,100,255)
- rh.CanCollide = false
- rh.Anchored = true
- local selec1 = Instance.new("SelectionBox",lh)
- selec1.Color3 = Color3.fromRGB(255,0,255)
- selec1.LineThickness = 0.15
- local selec2 = Instance.new("SelectionBox",rh)
- selec2.Color3 = Color3.fromRGB(255,0,255)
- selec2.LineThickness = 0.15
- local he = Instance.new("Part",workspace)
- he.Size = Vector3.new(2,2,2) * Vector3.new(size,size,size)
- he.CanCollide = false
- he.Transparency = 1
- he.Anchored = true
- local antispamright = false
- local antispamleft = false
- local laserrh = Instance.new("Part")
- laserrh.Color = Color3.fromRGB(255, 75, 230)
- laserrh.Name = "dksfbfkhsdhbfsjhd"
- laserrh.Material = "Neon"
- laserrh.Transparency = 1
- laserrh.Parent = workspace
- laserrh.CanCollide = false
- laserrh.Anchored = true
- local laserlh = Instance.new("Part")
- laserlh.Color = Color3.fromRGB(255, 75, 230)
- laserlh.Material = "Neon"
- laserlh.Transparency = 1
- laserlh.Name = "dksfbfkhsdhbfsjhd"
- laserlh.Parent = workspace
- laserlh.CanCollide = false
- laserlh.Anchored = true
- game.StarterGui:SetCore("VRLaserPointerMode", 0)
- game.StarterGui:SetCore("VREnableControllerModels", false)
- --now to wait for the server if it isn't called yet!
- local remote = game.Players.LocalPlayer:WaitForChild("VrC")
- remote:FireServer("Start",size)
- wait(.5)
- workspace:WaitForChild(game.Players.LocalPlayer.Name.."-Head").Transparency = 1
- selec1.Adornee = workspace:WaitForChild(game.Players.LocalPlayer.Name.."-LeftHand")
- selec2.Adornee = workspace:WaitForChild(game.Players.LocalPlayer.Name.."-RightHand")
- workspace:WaitForChild(game.Players.LocalPlayer.Name.."-LeftHand").Transparency = 1
- workspace:WaitForChild(game.Players.LocalPlayer.Name.."-RightHand").Transparency = 1
- local function multiplyCFrame(a, b)
- local ax, ay, az, a11, a12, a13, a21, a22, a23, a31, a32, a33 = a:components()
- local bx, by, bz, b11, b12, b13, b21, b22, b23, b31, b32, b33 = b:components()
- local x = ax*bx
- local y = ay*by
- local z = az*bz
- local m11 = a11*b11
- local m12 = a12*b12
- local m13 = a13*b13
- local m21 = a21*b21
- local m22 = a22*b22
- local m23 = a23*b23
- local m31 = a31*b31
- local m32 = a32*b32
- local m33 = a33*b33
- return CFrame.new(x, y, z, m11, m12, m13, m21, m22, m23, m31, m32, m33)
- end
- workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
- workspace.CurrentCamera.CFrame = CFrame.new(0,0,0) * CFrame.new(0,5*size,0)
- workspace.CurrentCamera.HeadScale = size
- RunService.RenderStepped:Connect(function()
- workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
- local curr = workspace.CurrentCamera.CFrame
- local head = (VRService:GetUserCFrame(Enum.UserCFrame.Head) * CFrame.new(0,0,0.2)) + Vector3.new(0,1.25*(4*(1-size)),0)
- he.CFrame = multiplyCFrame((curr * head),CFrame.new(size, size, size, 1, 1, 1, 1, 1, 1, 1, 1, 1))
- local lefthand = (VRService:GetUserCFrame(Enum.UserCFrame.LeftHand) * CFrame.new(0,0,0.2)) + Vector3.new(0,1.25*(4*(1-size)),0)
- lh.CFrame = multiplyCFrame((curr * lefthand),CFrame.new(size, size, size, 1, 1, 1, 1, 1, 1, 1, 1, 1))
- local righthand = (VRService:GetUserCFrame(Enum.UserCFrame.RightHand) * CFrame.new(0,0,0.2)) + Vector3.new(0,1.25*(4*(1-size)),0)
- rh.CFrame = multiplyCFrame((curr * righthand),CFrame.new(size, size, size, 1, 1, 1, 1, 1, 1, 1, 1, 1))
- lh.Size = Vector3.new(0.2,0.2,0.6) * Vector3.new(size,size,size)
- rh.Size = Vector3.new(0.2,0.2,0.6) * Vector3.new(size,size,size)
- he.Size = Vector3.new(2,2,2) * Vector3.new(size,size,size)
- remote:FireServer("update",{lh.CFrame,rh.CFrame,he.CFrame,size})
- end)
- function changeMode()
- if mode == 0 then
- lh.Color = Color3.fromRGB(255,100,255)
- rh.Color = Color3.fromRGB(255,100,255)
- selec1.Color3 = Color3.fromRGB(255,0,255)
- selec2.Color3 = Color3.fromRGB(255,0,255)
- laserlh.Color = Color3.fromRGB(255, 75, 230)
- laserrh.Color = Color3.fromRGB(255, 75, 230)
- elseif mode == 1 then
- lh.Color = Color3.fromRGB(100,100,255)
- rh.Color = Color3.fromRGB(100,100,255)
- selec1.Color3 = Color3.fromRGB(0,0,255)
- selec2.Color3 = Color3.fromRGB(0,0,255)
- elseif mode == 2 then
- lh.Color = Color3.fromRGB(255,100,100)
- rh.Color = Color3.fromRGB(255,100,100)
- selec1.Color3 = Color3.fromRGB(255,0,0)
- selec2.Color3 = Color3.fromRGB(255,0,0)
- elseif mode == 3 then
- lh.Color = Color3.fromRGB(100,255,100)
- rh.Color = Color3.fromRGB(100,255,100)
- selec1.Color3 = Color3.fromRGB(0,255,0)
- selec2.Color3 = Color3.fromRGB(0,255,0)
- laserlh.Color = Color3.fromRGB(100,255,100)
- laserrh.Color = Color3.fromRGB(100,255,100)
- laserlh.Transparency = 0.875
- laserrh.Transparency = 0.875
- elseif mode == 4 then
- lh.Color = Color3.fromRGB(255,255,100)
- rh.Color = Color3.fromRGB(255,255,100)
- selec1.Color3 = Color3.fromRGB(255,255,0)
- selec2.Color3 = Color3.fromRGB(255,255,0)
- elseif mode == 5 then
- lh.Color = Color3.fromRGB(100,255,255)
- rh.Color = Color3.fromRGB(100,255,255)
- lh.Transparency = 0.5
- rh.Transparency = 0.5
- selec1.Color3 = Color3.fromRGB(0,255,255)
- selec2.Color3 = Color3.fromRGB(0,255,255)
- end
- if mode ~= 3 then
- laserlh.Transparency = 1
- laserrh.Transparency = 1
- end
- if lastmode == 5 then
- coroutine.resume(coroutine.create(function()
- lh.Transparency = 0
- rh.Transparency = 0
- wait(1)
- workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-LeftHand").Transparency = 1
- workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-RightHand").Transparency = 1
- workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-Head").Transparency = 1
- end))
- end
- remote:FireServer("mode",mode)
- lastmode = mode
- end
- VRService:SetTouchpadMode(Enum.VRTouchpad.Right, Enum.VRTouchpadMode.ABXY)
- local UserInputService = game:GetService("UserInputService")
- UserInputService.InputBegan:Connect(function(input, gameProcessed)
- if input.KeyCode == Enum.KeyCode.ButtonY then
- if size >= 1 then
- size = size + 1
- elseif size >= 10 then
- size = size + 2
- elseif size >= 50 then
- size = size + 5
- elseif size >= 200 then
- size = size + 20
- elseif size < 1 then
- size = size * 2
- end
- workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
- local bon = workspace.CurrentCamera.CFrame
- workspace.CurrentCamera.CFrame = CFrame.new(bon.X*-1,0,bon.Z*-1) * CFrame.new(0,5*size,0)
- workspace.CurrentCamera.HeadScale = size
- elseif input.KeyCode == Enum.KeyCode.ButtonA then
- if size <= 1 then
- size = size / 2
- elseif size <= 10 then
- size = size - 1
- elseif size > 10 then
- size = size - 2
- end
- workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
- local bon = workspace.CurrentCamera.CFrame
- workspace.CurrentCamera.CFrame = CFrame.new(bon.X*-1,0,bon.Z*-1) * CFrame.new(0,5*size,0)
- workspace.CurrentCamera.HeadScale = size
- elseif input.KeyCode == Enum.KeyCode.ButtonR2 and mode == 0 then
- if antispamright == false then
- laserrh.Transparency = 0.875
- local csc = remote:FireServer("chargeright")
- antispamright = true
- end
- elseif input.KeyCode == Enum.KeyCode.ButtonL2 and mode == 0 then
- if antispamleft == false then
- laserlh.Transparency = 0.875
- local csc = remote:FireServer("chargeleft")
- antispamleft = true
- end
- elseif input.KeyCode == Enum.KeyCode.ButtonR2 and mode == 3 then
- if false == false then
- local csc = remote
- local plr = game.Players.LocalPlayer
- local ray = Ray.new(rh.CFrame.p,(rh.CFrame.LookVector) * 1000)
- print(tostring(workspace:FindPartOnRayWithIgnoreList(ray, {rh,workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-RightHand")})))
- csc:FireServer("GrabRight",{workspace:FindPartOnRayWithIgnoreList(ray, {rh,laserrh,laserlh,workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-RightHand")})})
- end
- elseif input.KeyCode == Enum.KeyCode.ButtonL2 and mode == 3 then
- if false == false then
- local csc = remote
- local plr = game.Players.LocalPlayer
- local ray = Ray.new(lh.CFrame.p,(lh.CFrame.LookVector) * 1000)
- csc:FireServer("GrabLeft",{workspace:FindPartOnRayWithIgnoreList(ray, {lh,laserrh,laserlh,workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-LeftHand")})})
- end
- elseif input.KeyCode == Enum.KeyCode.ButtonL1 then
- if antispamleft == false and antispamright == false then
- --grip left
- mode = mode - 1
- if mode < 0 then
- mode = maxmodes
- end
- changeMode()
- end
- elseif input.KeyCode == Enum.KeyCode.ButtonR1 then
- if antispamleft == false and antispamright == false then
- --grip left
- mode = mode + 1
- if mode > maxmodes then
- mode = 0
- end
- changeMode()
- end
- end
- if size <= 2 then
- selec1.LineThickness = 0.15/8
- selec2.LineThickness = 0.15/8
- else
- selec1.LineThickness = 0.15
- selec2.LineThickness = 0.15
- end
- end)
- UserInputService.InputEnded:Connect(function(input, gameProcessed)
- if input.KeyCode == Enum.KeyCode.ButtonR2 and mode == 0 then
- if antispamright == true then
- local csc = remote
- local plr = game.Players.LocalPlayer
- local tool = script.Parent
- local ray = Ray.new(rh.CFrame.p,(rh.CFrame.LookVector*Vector3.new(-1,-1,-1)) * 1000)
- csc:FireServer("ShootRight",{ray,rh.CFrame})
- laserrh.Transparency = 1
- antispamright = false
- end
- elseif input.KeyCode == Enum.KeyCode.ButtonR2 and mode == 3 then
- remote:FireServer("UngrabRight")
- elseif input.KeyCode == Enum.KeyCode.ButtonL2 and mode == 3 then
- remote:FireServer("UngrabLeft")
- elseif input.KeyCode == Enum.KeyCode.ButtonL2 and mode == 0 then
- if antispamleft == true then
- local csc = remote
- local plr = game.Players.LocalPlayer
- local tool = script.Parent
- local ray = Ray.new(rh.CFrame.p,(rh.CFrame.LookVector*Vector3.new(-1,-1,-1)) * 1000)
- csc:FireServer("ShootLeft",{ray,lh.CFrame})
- laserlh.Transparency = 1
- antispamleft = false
- end
- end
- end)
- function chat(mod,msg)
- wait(.2)
- local bap = mod.Head:FindFirstChild('bap')
- if bap ~= nil then
- local textlabel = mod.Head.bap.TextLabel
- textlabel.Text = msg
- coroutine.resume(coroutine.create(function()
- wait(8)
- if textlabel.Text == msg then
- textlabel.Text = ""
- end
- end))
- else
- coroutine.resume(coroutine.create(function()
- local bill = Instance.new("BillboardGui",mod.Head)
- bill.Name = "bap"
- bill.LightInfluence = 0
- bill.Size = UDim2.new(10,0,4,0)
- bill.StudsOffset = Vector3.new(0,2,0)
- local textlabel = Instance.new("TextLabel",bill)
- textlabel.Size = UDim2.new(1,0,1,0)
- textlabel.BackgroundTransparency = 1
- textlabel.TextColor3 = Color3.fromRGB(255,255,255)
- textlabel.TextStrokeColor3 = Color3.fromRGB(0,0,0)
- textlabel.TextStrokeTransparency = 0
- textlabel.Text = msg
- coroutine.resume(coroutine.create(function()
- wait(8)
- if textlabel.Text == msg then
- textlabel.Text = ""
- end
- end))
- end))
- end
- end
- for i,v in pairs(game.Players:GetChildren()) do
- coroutine.resume(coroutine.create(function()
- v.Chatted:Connect(function(msg)
- chat(v.Character,msg)
- end)
- local bill = Instance.new("BillboardGui",v.Character.Head)
- bill.Name = "bap"
- bill.LightInfluence = 0
- bill.Size = UDim2.new(10,0,4,0)
- bill.StudsOffset = Vector3.new(0,2,0)
- local textlabel = Instance.new("TextLabel",bill)
- textlabel.Size = UDim2.new(1,0,1,0)
- textlabel.BackgroundTransparency = 1
- textlabel.TextColor3 = Color3.fromRGB(255,255,255)
- textlabel.TextStrokeColor3 = Color3.fromRGB(0,0,0)
- textlabel.TextStrokeTransparency = 0
- textlabel.Text = ""
- end))
- end
- game.Players.PlayerAdded:Connect(function(plr)
- coroutine.resume(coroutine.create(function()
- plr.Chatted:Connect(function(msg)
- chat(plr.Character,msg)
- end)
- local bill = Instance.new("BillboardGui",plr.Character.Head)
- bill.Name = "bap"
- bill.LightInfluence = 0
- bill.Size = UDim2.new(10,0,4,0)
- bill.StudsOffset = Vector3.new(0,2,0)
- local textlabel = Instance.new("TextLabel",bill)
- textlabel.Size = UDim2.new(1,0,1,0)
- textlabel.BackgroundTransparency = 1
- textlabel.TextColor3 = Color3.fromRGB(255,255,255)
- textlabel.TextStrokeColor3 = Color3.fromRGB(0,0,0)
- textlabel.TextStrokeTransparency = 0
- textlabel.Text = ""
- end))
- end)
- coroutine.resume(coroutine.create(function()
- game:GetService("RunService").RenderStepped:connect(function()
- local plr = game.Players.LocalPlayer
- --righthand
- local ray = Ray.new(rh.CFrame.p,(rh.CFrame.LookVector) * 1000)
- local cf = rh.CFrame
- local part, position = workspace:FindPartOnRay(ray, plr.Character, false, true)
- local distance = ((cf.p - position)).magnitude
- laserrh.Size = Vector3.new((0.125*size)/4, (0.125*size)/4, distance)
- laserrh.CFrame = CFrame.new(cf.p, position) * CFrame.new(0, 0, -distance / 2)
- --lefthand
- local ray = Ray.new(lh.CFrame.p,(lh.CFrame.LookVector) * 1000)
- local cf = lh.CFrame
- local part, position = workspace:FindPartOnRay(ray, plr.Character, false, true)
- local distance = ((cf.p - position)).magnitude
- laserlh.Size = Vector3.new((0.125*size)/4, (0.125*size)/4, distance)
- laserlh.CFrame = CFrame.new(cf.p, position) * CFrame.new(0, 0, -distance / 2)
- if laserrh.Transparency == 1 and laserlh.Transparency == 1 then
- wait(.5)
- end
- end)
- end))
- while wait(1) do
- if selec1.Adornee == nil then
- coroutine.resume(coroutine.create(function()
- wait(1)
- workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-Head").Transparency = 1
- selec1.Adornee = workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-LeftHand")
- selec2.Adornee = workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-RightHand")
- workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-LeftHand").Transparency = 1
- workspace:FindFirstChild(game.Players.LocalPlayer.Name.."-RightHand").Transparency = 1
- end))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement