This may seem like a weird problem... So, here I have a script in Workspace that will clone a LocalScript into the player.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        script.LocalScript:clone().Parent = character
    end)
end)

Below I have the contents of the LocalScript which as two children of NumberValues one named TPV (which is 9) and another which is not implemented yet. I want the player to have the freedom to play in first or third person which is the camera min and max zoom distance, however I want to have the zoom distances increased by the other NumberValue only when the player is sitting in a vehicle. My problem is I'm having trouble accessing Humanoid.Sit because I can't get the players name outside of the studio environment.

local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character

Mouse = player:GetMouse()

thirdperson = script.TPV.Value
firstperson = 0.5

player.CameraMaxZoomDistance = thirdperson
player.CameraMinZoomDistance = thirdperson


function PressedV(key)
if key == "v" then
	if player.CameraMaxZoomDistance == thirdperson or 
	player.CameraMinZoomDistance == thirdperson then
		player.CameraMinZoomDistance = firstperson
		player.CameraMaxZoomDistance = firstperson
		wait()

	elseif player.CameraMaxZoomDistance == firstperson or 
	player.CameraMinZoomDistance == firstperson then
		player.CameraMaxZoomDistance = thirdperson
		player.CameraMinZoomDistance = thirdperson
		wait()

	end
end
end
Mouse.KeyDown:connect(PressedV)

3 comments

0

Uhhh... character.Humanoid.Sit?

0

I thought it was that simple, but it didn't seem to work... I'll try it again though.

0

Okay that did the trick lol. I just have to move a few lines around now. I thought character directed to game.players which was confusing me. Thanks for the help!