Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

VR Service detects mobile people as VR?

Hello.
I made a game all about VR. The VR person has their own nametag and it's customized like the character. When a mobile player joined, it changed the VR person to be just like him, he still had control and all, it just changed to be the mobile player. Is there any way to fix this? Thank you!
EDIT: This game is a VR-Hangout type. So other people can play.
LocalScript:

local VR = game:GetService("VRService")
local replicatedfirst = game:GetService("ReplicatedFirst")
local input = game:GetService("UserInputService")
local event = game.ReplicatedStorage:WaitForChild("SetPosition")
if VR.VREnabled then
	game.ReplicatedStorage.LoadCharacter:FireServer()
	while true do wait()
		event:FireServer(VR:GetUserCFrame(Enum.UserCFrame.RightHand),VR:GetUserCFrame(Enum.UserCFrame.LeftHand),VR:GetUserCFrame(Enum.UserCFrame.Head))
	end
end

Script:

local headpart = workspace[" "]
local Event = game.ReplicatedStorage.SetPosition
Event.OnServerEvent:connect(function(player,right,left,head)
	headpart.Head.CFrame = head
	workspace.righthand.CFrame = right
	workspace.lefthand.CFrame = left
end)

My camera script (It also has some problems):

script.Parent:WaitForChild("ScreenGui").Enabled = true
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local vr = game:GetService("VRService")
if vr.VREnabled then
	game.ReplicatedStorage:WaitForChild("SetNametag"):FireServer()
	print("Starting Camera Code...")
	repeat wait()
		camera.CameraType = Enum.CameraType.Scriptable
	until camera.CameraType == Enum.CameraType.Scriptable
	camera.CFrame = CFrame.new(0,0,0)
	print("Finished Camera Code.")
end

3 comments

0

A Mobile Players allowed in this VR Game?

0

Yup

0

Well, it's like a VR hangout type game

1 answer

✓ Accepted answer

Well, because the mobile player can be detected as a VR player, then we will add a status for a mobile player by checking.

local UIS = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
local VRService = game:GetService("VRService")
local isMobile = false
if UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled
   and not UIS.GamepadEnabled and not GuiService:IsTenFootInterface() then
	isMobile = true
end
---Your code
if not isMobile and VRService.VREnabled then
	--Your codes
end

This will also return laptop with touchable screen true.

More details: Dev Forum

1 comment

0

Thank you! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.