the errors say ServerScriptService.VRCheck:12: attempt to index nil with âHumanoidRootPartâ
and the name of the mesh is âmeshâ so i dont think thats an issue
game.Players.PlayerAdded:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local userInputService = game:GetService("UserInputService")
local isUsingVR = userInputService.VREnabled
char.Humanoid.Died:Connect(function()
wait(3) -- change 3 to the wait time
if isUsingVR then
player.Character.HumanoidRootPart.Position = workspace.VRPlrSpawn
else
player.Character.HumanoidRootPart.Position = workspace.NonVRPlrSpawn.Position
end
end)
if (isUsingVR) then
print("VR Player!")
char.Head.Mesh.MeshID = "https://assetdelivery.roblox.com/v1/asset/?id=9900352066"
char.Head.Mesh.TextureID = "rbxassetid://9900377131"
player.Character.HumanoidRootPart.Position = workspace.VRPlrSpawn
else
print("Non VR Player")
player.Character.HumanoidRootPart.Position = workspace.NonVRPlrSpawn.Position
end
end)
I forgot to add a delay, after the died function add a delay until the player respawns, the respawns time is a property in game.Players take That time and add 0.1 to it and have that as the delay
i know we already solved this but i was wondering, since youre like the only one who understands what im doing do you think i can make it so the vr player is in a specific spot with this intermission system?
--Thanks for using this script
--This script is made by Joriangames/Problox Studio Scripts
--Want to know how to use this? Watch my tutorial: https://youtu.be/kUqQhNT3hUE
local maps = game:GetService("ServerStorage").Maps:GetChildren()
local Title = game.StarterGui.MapSelector.Title
local spawns = game.Workspace.Spawns:GetChildren()
local status = game.ReplicatedStorage.Status
ti = 0
while true do
ti = 10
repeat
ti = ti -1
status.Value = "Intermission "..ti
wait(1)
until ti == 0
local randomMap = maps[math.random(1, #maps)]
randomMap:Clone().Parent = workspace
current = randomMap.Name
status.Value = "Chosen game is "..randomMap.Name
wait(5)
status.Value = "Loading game!"
wait(3)
status.Value = "Starting game!"
wait(2)
local plrs = game.Players:GetChildren()
for i = 1, #plrs do
local randomSpawn = spawns[math.random(1, #spawns)]
plrs[i].Character.HumanoidRootPart.CFrame = CFrame.new(randomSpawn.Position)
end
ti = 10
repeat
ti = ti -1
status.Value = ti.." seconds left!"
wait(1)
until ti == 0
for i = 1, #plrs do
plrs[i].Character.HumanoidRootPart.CFrame = workspace.SpawnLocation.CFrame + Vector3.new(0, 10, 0)
--VR PLAYER TP TO CERTAIN SPOT
end
workspace[current]:Destroy()
end
for i = 1, #plrs do
local randomSpawn = spawns[math.random(1, #spawns)]
plrs[i].Character.HumanoidRootPart.CFrame = CFrame.new(randomSpawn.Position)
end
if the player is in VR they should have there own spawns in that island so other than spawns have VRSpawns with it