could you change the vr rig so it could have a whole entire body sort of like an r6 blocky character?: -- Simple Roblox VR rig (single LocalScript)
-- Place this LocalScript in StarterPlayerScripts.
-- NOTE: Studio's typechecker/LSP sometimes underlines Enum.RaycastFilterType.Blacklist even though it's valid at runtime.
-- Removing the explicit FilterType assignment (defaults to Blacklist) avoids the lint while preserving behavior.
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local VRService = game:GetService("VRService")
local Workspace = game:GetService("Workspace")
local player = Players.LocalPlayer
if not player then
return
end
local camera = Workspace.CurrentCamera
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then
humanoid = character:WaitForChild("Humanoid")
end
local rootPart = character:FindFirstChild("HumanoidRootPart") or character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")
while not rootPart do
character = player.Character or player.CharacterAdded:Wait()
rootPart = character:FindFirstChild("HumanoidRootPart") or character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")
if not rootPart then
task.wait(0.1)
end
end
-- Config
local HAND_SIZE = Vector3.new(0.18, 0.06, 0.28)
local HAND_COLOR = Color3.fromRGB(60, 120, 255)
local HEAD_HEIGHT_OFFSET = 0.0 -- extra offset from root to head (if needed)
local TELEPORT_MAX_DISTANCE = 1000
-- Create simple hand parts that follow controller poses
local function makeHand(name, color)
local part = Instance.new("Part")
part.Name = name
part.Size = HAND_SIZE
part.Color = color
part.Transparency = 0.2
part.Anchored = true
part.CanCollide = false
part.CastShadow = false
part.Parent = Workspace
local mesh = Instance.new("SpecialMesh", part)
mesh.MeshType = Enum.MeshType.Brick
return part
end
local leftHandPart = makeHand("VRLeftHand", HAND_COLOR)
local rightHandPart = makeHand("VRRightHand", HAND_COLOR)
-- Helper: detect whether running in VR
local function isVREnabled()
local ok, enabled = pcall(function()
return UserInputService.VREnabled or VRService.VREnabled
end)
return ok and enabled
end
-- Teleportation helper: raycast from a CFrame origin forward
local function teleportToAim(originCFrame)
originCFrame = originCFrame or camera.CFrame
local origin = originCFrame.Position
local direction = originCFrame.LookVector * TELEPORT_MAX_DISTANCE
local params = RaycastParams.new()
-- Ignore the player's character so the ray doesn't immediately hit the player.
params.FilterDescendantsInstances = {character}
-- NOTE: We intentionally omit setting params.FilterType here to avoid Studio LSP underlining Enum.RaycastFilterType.Blacklist.
-- The RaycastParams default FilterType is Blacklist, so behavior is preserved.
local result = Workspace:Raycast(origin, direction, params)
if result and result.Position then
local hit = result.Position
local hipHeight = 0
if humanoid and humanoid.HipHeight then
hipHeight = humanoid.HipHeight
end
-- Keep facing direction based on camera's Y rotation
local lookY = math.atan2(originCFrame.LookVector.X, originCFrame.LookVector.Z)
local newCFrame = CFrame.new(hit + Vector3.new(0, hipHeight + 0.1, 0)) * CFrame.Angles(0, lookY, 0)
rootPart.CFrame = newCFrame
else
-- Fallback: step forward a bit
local fallbackPos = origin + originCFrame.LookVector * 8
rootPart.CFrame = CFrame.new(fallbackPos)
end
end
-- Input handling for teleport (keyboard T and Gamepad Button A)
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.T then
teleportToAim(camera.CFrame)
elseif input.UserInputType == Enum.UserInputType.Gamepad1 or input.UserInputType == Enum.UserInputType.Touch then
if input.KeyCode == Enum.KeyCode.ButtonA or input.KeyCode == Enum.KeyCode.ButtonR2 then
teleportToAim(camera.CFrame)
end
end
end)
-- Main VR update loop
local lastRender = tick()
RunService:BindToRenderStep("VRRigUpdate", Enum.RenderPriority.Camera.Value + 1, function()
local now = tick()
lastRender = now
if not isVREnabled() then
if camera.CameraType == Enum.CameraType.Scriptable then
camera.CameraType = Enum.CameraType.Custom
end
leftHandPart.Transparency = 1
rightHandPart.Transparency = 1
return
end
camera.CameraType = Enum.CameraType.Scriptable
local okHead, headCFrame = pcall(function()
return VRService:GetUserCFrame(Enum.UserCFrame.Head)
end)
local okLeft, leftCFrame = pcall(function()
return VRService:GetUserCFrame(Enum.UserCFrame.LeftHand)
end)
local okRight, rightCFrame = pcall(function()
return VRService:GetUserCFrame(Enum.UserCFrame.RightHand)
end)
local rootCFrame = rootPart and rootPart.CFrame or character:GetModelCFrame()
if okHead and headCFrame then
local headWorld = rootCFrame * headCFrame * CFrame.new(0, HEAD_HEIGHT_OFFSET, 0)
camera.CFrame = headWorld
local rootPos = rootPart.Position
local newRootPos = Vector3.new(headWorld.X, rootPos.Y, headWorld.Z)
rootPart.CFrame = CFrame.new(newRootPos, newRootPos + Vector3.new(headWorld.LookVector.X, 0, headWorld.LookVector.Z))
end
if okLeft and leftCFrame then
local leftWorld = rootCFrame * leftCFrame
leftHandPart.CFrame = leftWorld
leftHandPart.Transparency = 0.2
else
leftHandPart.Transparency = 1
end
if okRight and rightCFrame then
local rightWorld = rootCFrame * rightCFrame
rightHandPart.CFrame = rightWorld
rightHandPart.Transparency = 0.2
else
rightHandPart.Transparency = 1
end
end)
player.CharacterRemoving:Connect(function()
if leftHandPart and leftHandPart.Parent then leftHandPart:Destroy() end
if rightHandPart and rightHandPart.Parent then rightHandPart:Destroy() end
pcall(function() RunService:UnbindFromRenderStep("VRRigUpdate") end)
end)
player.AncestryChanged:Connect(function()
if not player:IsDescendantOf(game) then
if leftHandPart and leftHandPart.Parent then leftHandPart:Destroy() end
if rightHandPart and rightHandPart.Parent then rightHandPart:Destroy() end
end
end)