Custom Character cannot access player GUI


I have a script that opens a GUI when a player presses a button. However, when my Character spawns as a custom character, the output says that PlayerGui is not a valid member of players “BigTruck2040”. Is there any way to fix this?
This is the code to change the character:

script.Parent.Activated:Connect(function()
	local player = game.Players.LocalPlayer
	local model = game.ReplicatedStorage.T_Rex
	local model1 = model:Clone()
	player.Character.HumanoidRootPart.CFrame = model1.PrimaryPart.CFrame
	player.Character = model1
	model1.Parent = game.Workspace
end)

I changed the code to this, but it still doesn’t work.

script.Parent.Activated:Connect(function()
	local player = game.Players.LocalPlayer
	local model = game.ReplicatedStorage.T_Rex
	local model1 = model:Clone()
    model1.Name = "StarterCharacter"
	player.Character.HumanoidRootPart.CFrame = model1.PrimaryPart.CFrame
	player.Character = model1
	model1.Parent = game.Workspace
end)

Did you rename your custom character properly, as StarterCharacter ?

  • Could you also send some more images of the explorer tab ?

Is this what you were asking for?