Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

VR Service detects mobile people as VR?

Asked by 4 years ago
Edited 4 years ago

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
0
A Mobile Players allowed in this VR Game? Tizzel40 243 — 4y
0
Yup ViviTheLuaKing 103 — 4y
0
Well, it's like a VR hangout type game ViviTheLuaKing 103 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

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

0
Thank you! :) ViviTheLuaKing 103 — 4y
Ad

Answer this question