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

Why wont my script work for kicking players that dont use a VR headset?

I took VRService.VREnabled from robloxs site, and put the kick line in it, but it wont print anything or kick me. (it is in a localscript in workspace). Im very new to scripting so sorry.

local userInputService = game:GetService("UserInputService")

local isUsingVR = userInputService.VREnabled
if (isUsingVR) then
	print("has vr headset :D")
else
	print("Turn on your VR headset! This game requires VR")
	game.Players.Player1:Kick()
end

1 comment

0

try to put the local script at StarterGui,StarterPack,StarterCharacterScripts or StarterPlayerScripts

1 answer

✓ Accepted answer

First Put In in StarterGui Roblox Only Allows LocalScripts In The Player Also Dont Just Go Like game.Players.Player1:Kick()You Wont Be Able To Kick Anybody Else What I Will Do Islocal userInputService = game:GetService("UserInputService") local Player = game.Players.LocalPlayer local isUsingVR = userInputService.VREnabled if (isUsingVR) then print("has vr headset :D") else print("Turn on your VR headset! This game requires VR") game.Players[Player.Name]:Kick() end `

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