local Players = game:GetService("Players")
local player = Players.LocalPlayer
-- Wait until the character fully loads and has a HumanoidRootPart
local function waitForCharacterWithRoot()
local character = player.Character or player.CharacterAdded:Wait()
while not (character and character:IsA("Model") and character:FindFirstChild("HumanoidRootPart")) do
task.wait()
end
return character
end
-- Wait for GUI to be ready
local playerGui = player:WaitForChild("PlayerGui")
local screenGui = playerGui:WaitForChild("ScreenGui")
local viewport = screenGui:WaitForChild("ViewportFrame")
-- Remove old model from viewport
local oldModel = viewport:FindFirstChildOfClass("Model")
if oldModel then
oldModel:Destroy()
end
-- Load character safely
local character = waitForCharacterWithRoot()
print("Character loaded:", character)
-- Clone character
local clonedChar = character:Clone()
if not clonedChar or not clonedChar:IsA("Model") then
warn("Cloning failed.")
return
end
-- Set PrimaryPart if needed
local root = clonedChar:FindFirstChild("HumanoidRootPart")
if not root then
warn("Cloned character missing HumanoidRootPart.")
return
end
clonedChar.PrimaryPart = root
clonedChar.Parent = viewport
-- Setup a camera
local camera = Instance.new("Camera")
camera.CFrame = CFrame.new(Vector3.new(0, 2.5, 6), Vector3.new(0, 2.5, 0))
viewport.CurrentCamera = camera
camera.Parent = viewport
#player.character returning nil
1 messages · Page 1 of 1 (latest)
little test script i made in a brand new studio
idk if im just dumb or something but PLAYER.CHARACTER IS NIL???
i dont know how to get the message with the colors
so what im seeing is local character is a function
Goofy ahh
AM I DUMB
WHAT AM I MISSING
ya know what ill make a brand new script
local character = player.Character or player.CharacterAdded:Wait()
local charclone = character:Clone()
charclone.Parent = game.Workspace
brand new script i made
and THIS game ne an erro
error
attempt to index nil with parent
what am i doing brong broooooo
I remember there's something that prevents player characters from being able to be cloned
Archivable?
i swear if thats the problem
i think they still can be cloned
then im gonna explode
hmmm
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
if character then
local charclone = character:Clone()
charclone.Parent = game.Workspace
else
warn("Character is nil!")
end
try this
doesnt even get to the warn part
it gives me attempt to index nil witth parent
ima try changing the archivable
or just remove player.CharacterAdded:Wait() and just keep player.Character
ok
💀💀💀
3 hours lmao