I’ve been trying to change the CameraSubject to a Part in an Accessory’s Handle but been unable to do. I’ve looked through the DevForum and other websites for the last 3 hours and still can’t solve this simple problem. It’d be helpful if I could get some help. Here is the code. Everything works fine up to Line 15 which doesn’t even work. I have tested it by replacing the CameraSubject with the CameraType, yet unable to change the property. More info, the script is in StarterPlayerScripts.
(The 5th line is waiting for a code that loads the accessory into the avatar. First line is the event that is waiting to be fired for the value to change)
game:GetService("ReplicatedStorage"):WaitForChild("Events").CharacterLoaded.OnClientEvent:Connect(function()
game.Workspace.Camera.CameraSubject = game.Players.LocalPlayer.Character
game:GetService("ReplicatedStorage"):WaitForChild("CharacterLoaded").Value = true
end)
repeat wait() until game:GetService("ReplicatedStorage"):WaitForChild("CharacterLoaded").Value == true
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local rootpart = char:WaitForChild("HumanoidRootPart")
local Humanoid = char:WaitForChild("Humanoid")
local camera = workspace.CurrentCamera
camera.CameraSubject = char.CameraAccessory.Handle.Camera
repeat wait()
game.Workspace.CurrentCamera.CameraSubject = char.CameraAccessory.Handle.Camera
until game.Workspace.CurrentCamera.CameraSubject == char.CameraAccessory.Handle.Camera