Removes tools when on VR

How do I make a script that when a Player joins on vr all their items removes? I just have tools that aren’t compatible on VR and will break their character when equipped.

Use UserInputService to get the LocalPlayer‘s device and then use :Destroy()

You’re going to want two scripts:

A server script (which you want to put inside the ServerScriptService)

-- creates a remote event which will get fired when the player's character joins in VR
local remote = Instance.new("RemoteEvent")
remote.Name = "VREnabled"
remote.Parent = game.ReplicatedStorage

-- this bit of code gets fired when the players character joins in vr
remote.OnServerEvent:Connect(function(player)
	print(player.Name .. " is using VR!")
        -- clears out the players backpack
	player.Backpack:ClearAllChildren()
end)

And then a local script (which you’re going to want to put inside the StarterCharacterScripts)

local VRService = game:GetService("VRService")
local player = game.Players.LocalPlayer

-- gets the remote created in the server script
local remote = game.ReplicatedStorage:WaitForChild("VREnabled")

-- if we are in vr, it uses the remote to run the code in the server script server 
if VRService.VREnabled then
	print("firing server")
	remote:FireServer()
end

Let me know if anything doesn’t work or if you have any questions.

Hey, So sadly I still have items that gave me when I spawned.
image

I am pretty sure there was no errors but just a message saying I was on vr.

@royaltoe I also forgot to say that I have weapons system that automatically gives you when spawned so is there a way to make a Loop for that tool remover?

Can you show me a picture of the tool in your character in the explorer and/or the tool icon? Are you sure this is a tool not a fully scripted weapon?

If we can’t troubleshoot here, I have a headset I can test with if you would be comfortable adding me to team create or giving me a copy.