Looking at your error message, maybe try using clone.PrimaryPart instead of HumanoidRootPart. You, of course, have to set the HumanoidRootPart to the PrimaryPart of the model if you haven’t yet.
game.ReplicatedStorage.StorylineRemotes.Chapter1.Remote1.OnClientEvent:Connect(function()
print("Client received")
local camera = game.Workspace.CurrentCamera
local bom1 = require(game.ReplicatedStorage.UIModules.BOrWModule)
local player = game.Players.LocalPlayer
local character = player.Character
local startingpos = Vector3.new(2.475, -212.676, 312.173)
if not character then
character = player.CharacterAdded:Wait()
end
bom1:UIs(player, 1.5, "Black", 0.5)
local clone = character:Clone()
clone.Parent = game.Workspace
clone:SetPrimaryPartCFrame(CFrame.new(startingpos)) -- Set the position using CFrame
-- Optionally, you can create a force field for the clone
local immu1 = Instance.new("ForceField", clone)
immu1.Visible = false
local immu2 = Instance.new("ForceField", clone)
immu2.Visible = false
immu2.Name = "Iframes"
player.Character = clone
clone.HumanoidRootPart.CFrame = CFrame.new(startingpos) -- Set the position again
wait(0.1) -- Wait for the character to load
camera.CameraType = Enum.CameraType.Custom
camera.CFrame = CFrame.new(clone.HumanoidRootPart.Position + Vector3.new(0, 5, -10), clone.HumanoidRootPart.Position)
-- Restore the original character after some time
wait(5) -- Adjust the time as needed
player.Character = character
clone:Destroy()
end)
In this modified code:
I’ve made sure that the character variable is set correctly
I’ve used Vector3.new for the startingpos variable
I’ve used the SetPrimaryPartCFrame method to set the position of the clone
I’ve set the camera.CameraType and camera.CFrame to focus on the clone
After a certain time (you can adjust the waiting time), it restores the original character and destroys the clone
I changed the Archivable property to true but the StarterCharacter I have is already set to true, so if I’m following what you said I change the Archivable property to the opposite of the StarterCharacter which is going to be false.
By doing this wouldn’t it make cloning the character impossible?
game.ReplicatedStorage.StorylineRemotes.Chapter1.Remote1.OnClientEvent:Connect(function()
print("Client received")
local camera = game.Workspace.Camera
local bom1 = require(game.ReplicatedStorage.UIModules.BOrWModule)
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
bom1:UIs(player,1.5,"Black",0.5)
--local function cameraloop ()
-- camera.CFrame =
--end
local startingpos = "2.475, -212.676, 312.173"
player.Character.Archivable = false
local clone = character:Clone()
clone.Parent = game.Workspace
player.Character.Archivable = true
local immu1 = Instance.new("ForceField",clone)
immu1.Visible = false
local immu2 = Instance.new("ForceField",clone)
immu2.Visible = false
immu2.Name = "Iframes"
clone.PrimaryPart = clone.HumanoidRootPart
clone.PrimaryPart.Position = startingpos
end)