I am trying to make a seat that puts a player's camera at the barrel of a gun, but it can't find out who is sitting in the seat.
This is the localscript in the player's backpack.
local cam = game.Workspace.CurrentCamera local player = game.Players.LocalPlayer.Name while true do if _G.PlayerInSeat == player then cam.CameraSubject = game.Workspace.Vehicle.GunIgnore.Barrel cam.CameraType = "Attach" else --[[cam.CameraSubject = player.Character.Humanoid cam.CameraType = "Custom"]] end wait(0.1) end
This is the script that detects the player in the seat.
_G.PlayerInSeat = "" while true do _G.PlayerInSeat = script.Parent.Occupant.Parent wait(0.01) end
Thank you.