#camera
1 messages · Page 1 of 1 (latest)
make the cameratype Custom and the camerasubject be the player's character's humanoid
the camerasubject should be a part instance
the subject is the humanoid by default
if you just set it to a part then you wont be able to go in first person correctly anymore n stuff
local Players = game:GetService("Players")
local camera = workspace.CurrentCamera
ui.MouseButton1Click:Connect(function()
local player = Players.LocalPlayer
if player then
ui.Visible = false
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = player
end
end)
``` yeah i tried this but it doesn't work
idk how to use Humanoid here
its a localscript in startergui
it just makes my mouse stuck in the middle
(i set the games default settings camera type to lockfirstperson)
player.Character.Humanoid
local Players = game:GetService("Players")
local camera = workspace.CurrentCamera
local player = Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
ui.Visible = false
if player then
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = player.Character.Humanoid
end
end)
``` my mouse just stays stuck in the middle still and my new camera isn't set
ok mouse is fine
its just the camera
as its first person so the mouse yeah
local mouse = game.Players.LocalPlayer:GetMouse()
local cam = workspace.CurrentCamera
local camPart = workspace:WaitForChild("MainCamera")
local Scale = 3000
cam.CameraType = Enum.CameraType.Scriptable
game:GetService("RunService").RenderStepped:Connect(function()
local center = Vector2.new(cam.ViewportSize.X/2, cam.ViewportSize.Y/2)
local x = mouse.X - center.X / 2
local y = mouse.Y - center.Y / 2
local xOffset = x/Scale
local yOffset = y/Scale
local lookAtPoint = camPart.Position+camPart.CFrame.LookVector*5
local vector = Vector3.new(
lookAtPoint.X - xOffset,
lookAtPoint.Y - yOffset,
lookAtPoint.Z - xOffset)
local result = CFrame.lookAt(camPart.CFrame.Position,vector)
cam.CFrame = result
end)
``` yeah i made a big mistake, i use this for camera
how would i revert to default camera?
bump