Camera doesnt follow newly given StarterCharacter

Hi, i am trying to make a script where only 1 player can get this morph. Heres my script:

My code block is broken :

local RS = game:GetService(“ServerStorage”)
local Players = game:GetService(“Players”)
while true do
wait(0.1)
if script.Parent.Name == “skeletonpiratejack” then
local ah = RS.StarterCharacter:Clone()
ah.Parent = workspace
local laam = script.Parent
local breh = Players:GetPlayerFromCharacter(laam)
breh.Character = ah
wait(300000000)
end
end

and Heres the result:

I need to know why the camera isnt following the character and how to do the “1 player only character” morph correctly.
Help appreciated!

1 Like

You can try set the CameraSubject of the CurrentCamera to the Humanoid’s new Character.

Yes you can use RemoteEvents

local Event = game.ReplicatedStorage:WaitForChild("SetCamera")
Event.OnClientEvent:Connect(function(humanoid)
    workspace.CurrentCamera.CameraSubject = humanoid
end)

And in normal script

game.ReplicatedStorage.SetCamera:FireClient(player object here, your characters humanoid)
1 Like

apparently it doesnt work
heres my sword:

local RS = game:GetService(“ServerStorage”)
local Players = game:GetService(“Players”)
while true do
wait(0.1)
if script.Parent.Name == “skeletonpiratejack” then
local ah = RS.StarterCharacter:Clone()
ah.Parent = workspace
local laam = script.Parent
local breh = Players:GetPlayerFromCharacter(laam)
breh.Character = ah
wait(0.1)
game.ReplicatedStorage.SetCamera:FireClient(breh,laam.Humanoid)
wait(300000000)
end
end

localscript(i put it in starterplayercharacter) :

local Event = game.ReplicatedStorage:WaitForChild(“SetCamera”)
Event.OnClientEvent:Connect(function(humanoid)
workspace.CurrentCamera.CameraSubject = humanoid
end)

Uhh rs is Server Storage, u need Replicated Storage.

fixed script

local RS = game:GetService(“ReplicatedStorage”)
local Players = game:GetService(“Players”)
while true do
wait(0.1)
if script.Parent.Name == “skeletonpiratejack” then
local ah = RS.StarterCharacter:Clone()
ah.Parent = workspace
local laam = script.Parent
local breh = Players:GetPlayerFromCharacter(laam)
breh.Character = ah
wait(0.1)
game.ReplicatedStorage.SetCamera:FireClient(breh,laam.Humanoid)
wait(300000000)
end
end