I am trying to make a Gorilla tag vr game like Jungle Bungalows-VR

I tried to find the error but i cannot find it

I cannot seem to find any error that is causing "VRService is not a valid member of StarterPlayer “StarterPlayer” "

Code

local StarterPlayer = game:GetService("StarterPlayer")
StarterPlayer.VRService.Enabled = true

local function createVRCharacter()
    local character = Instance.new("Model")
    character.Name = "VRCharacter"

    local head = Instance.new("Part")
    head.Name = "Head"
    head.Size = Vector3.new(2, 1, 1)
    head.Position = Vector3.new(0, 5, 0)
    head.Parent = character

    local torso = Instance.new("Part")
    torso.Name = "Torso"
    torso.Size = Vector3.new(2, 2, 1)
    torso.Position = Vector3.new(0, 3, 0)
    torso.Parent = character

    local leftArm = Instance.new("Part")
    leftArm.Name = "LeftArm"
    leftArm.Size = Vector3.new(1, 2, 1)
    leftArm.Position = Vector3.new(-1.5, 3, 0)
    leftArm.Parent = character

    local rightArm = Instance.new("Part")
    rightArm.Name = "RightArm"
    rightArm.Size = Vector3.new(1, 2, 1)
    rightArm.Position = Vector3.new(1.5, 3, 0)
    rightArm.Parent = character

    character.Parent = workspace
    return character
end


local vrCharacter = createVRCharacter()


local function onMove(input, gameProcessed)
    if gameProcessed then return end

    local moveDirection = Vector3.new(0, 0, 0)
    if input.KeyCode == Enum.KeyCode.W then
        moveDirection = Vector3.new(0, 0, -1)
    elseif input.KeyCode == Enum.KeyCode.S then
        moveDirection = Vector3.new(0, 0, 1)
    elseif input.KeyCode == Enum.KeyCode.A then
        moveDirection = Vector3.new(-1, 0, 0)
    elseif input.KeyCode == Enum.KeyCode.D then
        moveDirection = Vector3.new(1, 0, 0)
    end

    vrCharacter:PivotTo(vrCharacter:GetPivot() * CFrame.new(moveDirection))
end

game:GetService("UserInputService").InputBegan:Connect(onMove)

I need help and if no one knows the answer i will just start a new game

1 Like