So, I am a beginning coder, and I have a great idea for a cutscene, however, it involves the player in first person mode, and I have all the elements there, I just don’t know how to make it so they cant move their screen around as it focuses on them.
I want the camera to be as though the person is walking around in first person, but none of their controls work.
Ive made the camera type scriptable, but as the character walks away, the camera just stays in the spot where they once were.
anyone have any ideas on how I can do this?
Thanks
-Revelted
EDIT: Ive also tried binding their mouse movement to no avail, and thats the biggest part, I have all their movement controls bound, but when you’re in first person, moving your mouse automatically moves your screen, so that where I’m confused :F
You could bind a function to RenderStepped that sets the camera’s CFrame to the Head’s CFrame. You’ll have to ditch any hats and make the head’s transparency 1 as well - if you’re using it directly on a player, LocalTransparencyModifier may help out with that process.
Like I said before, I am a new coder, and was wondering if I did this wrong and how to fix it >.<
for i,v in pairs(workspace:WaitForChild(player):GetChildren()) do
if v.Name == "Head" then
v.LocalTransparencyModifier = 1
elseif v:IsA("Accessory") then
v.Handle.LocalTransparencyModifier = 1
end
end
In a LocalScript in a container that will run them:
local RunService = game:GetService("RunService")
local LocalPlayer = game:GetService("Players").LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:wait()
local ItemsToHide = {}
for _, Descendant in pairs(Character:GetDescendants()) do
if type(Descendant) == "userdata" and typeof(Descendant) == "Instance" and Descendant:IsA("BasePart") and (Descendant.Name:lower() == "head" or Descendant:FindFirstAncestorOfClass("Accessory")) then
table.insert(ItemsToHide, Descendant)
end
end
-- To hide
RunService:BindToRenderStep("SetTransparency", Enum.RenderPriority.Character.Value, function()
for _, Item in pairs(ItemsToHide) do
Item.LocalTransparencyModifier = 1
end
end)
-- To release hide
--RunService:UnbindFromRenderStep("SetTransparency")
I’ve never worked with a system like this, all I can do is write its respective code. Feel free to ask questions about this or salvage it in your project as you wish.