So I've been trying in every way possible but I just can't figure out why my script isn't working. I've managed to get rid of any errors so no errors. I basically wanna make a gui that changes the character by changing the local player's character to some other model, I've managed to do that but now I'm just struggling to figure out how to change the camera subject from the humanoid without any body parts to the actual new character assigned.
local ReplicatedStorage = script.Parent.Parent.Parent.Parent.Functions local createPartEvent = ReplicatedStorage:WaitForChild("bigheadyellow") local CurrentCamera = workspace.CurrentCamera local plr = game.Players.LocalPlayer local pln = script.Parent.Parent.Parent.Parent.Parent.Parent.Name function onClicked() createPartEvent:FireServer() wait(1) CurrentCamera.CameraType = "Scriptable" CurrentCamera.CameraSubject = plr.Character.Humanoid end script.Parent.MouseButton1Down:connect(onClicked)
The reason why you can't change the camerasubject is because you are setting the cameratype to Scriptable, which basically makes it so that the main camerascript stops controlling the camera.
If you want it so that the camera is static and the camera is set somewhere.
local ReplicatedStorage = script.Parent.Parent.Parent.Parent.Functions local createPartEvent = ReplicatedStorage:WaitForChild("bigheadyellow") local CurrentCamera = workspace.CurrentCamera local plr = game.Players.LocalPlayer local pln = script.Parent.Parent.Parent.Parent.Parent.Parent.Name function onClicked() createPartEvent:FireServer() wait(1) CurrentCamera.CameraType = "Scriptable" --set its location with a cframe CurrentCamera.CFrame=CFrame.new() end script.Parent.MouseButton1Down:connect(onClicked)
Or if you want to reset the camera so that it goes back to normal you have to set the cameratype to Custom, which the to default value that most games are set to.
local ReplicatedStorage = script.Parent.Parent.Parent.Parent.Functions local createPartEvent = ReplicatedStorage:WaitForChild("bigheadyellow") local CurrentCamera = workspace.CurrentCamera local plr = game.Players.LocalPlayer local pln = script.Parent.Parent.Parent.Parent.Parent.Parent.Name function onClicked() createPartEvent:FireServer() wait(1) CurrentCamera.CameraType = "Custom" CurrentCamera.CameraSubject = plr.Character.Humanoid end script.Parent.MouseButton1Down:connect(onClicked)