Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Custom Character not working?

Idea Disable the game from loading the characters Appearance, and then apply my own from a model.
Problem I get the following error ServerScriptService.Game_.Characters_.Disabler:4: attempt to call method 'Clone' (a nil value)
Code

game.Players.PlayerAdded:connect(function(Plr)
    Plr.CanLoadCharacterAppearance = false
 wait(5)
	game.ServerStorage.Char:GetChildren():Clone(Plr.Character)
end)

Thanks :D

1 answer

✓ Accepted answer

This is not exactly how you would get a custom character. what you need to do is set the character to the custom character. Put the script in a localscript inside starterplayer.

wait(1)
local player --First we get the player
while not player do -- make sure we get the player.
	wait()
	player = game:GetService('Players').LocalPlayer
end
function onSpawn()
	local char = game.ReplicatedStorage["ModelName"]:Clone() --first we clone the new character either use ServerStorage or ReplicatedStorage. ( you decide :) )
	char.Parent = workspace --then we parent it to workspace
	char.Name = player.Name --next we can set it to the player's name
	
	local prevChar = player.Character --get the old character
	wait()
	player.Character = char --set it to the new one
	prevChar:Destroy() --destroy the old one
	
	if char:FindFirstChild("Humanoid") then
	char.Humanoid:Destroy() --destroy a humanoid if it already exists
	end
	local human = Instance.new("Humanoid", char) --Add a new humanoid
	char.Archivable = false --Set Archivable to false.

	human.Died:connect(function() --Now we create a respawn function
	wait(1) --change this to whatever time you want it to take to reload the character
	onSpawn()
	end)
end

onSpawn() --After all that we run the function.

That is all you need to do! but make sure you have already jointed every part of the character and have a head and torso and humanoid root part object!

if this helped please accept ~KIheros :)

3 comments

0

Hey, Thanks this is great :D, anyway to make it a module so it can be accessed through another "main game" script?

0

Maybe, not great at modules. :(

0

Thats alright :D

This discussion is preserved as it was. New answers, comments, and votes are closed.