Name the character StarterCharacter and put it in game.StarterPlayer
oh. I will see if I can do that.
This is sure to help!
@Sudden_Demise already posted a way to solve the problem using loadcharacter and I believe it will work. (Well, it uses loadcharacter for other players and a custom character loading function for the spesific player.)
wait a second.
Thank you so much! It works.
I noticed that your code only respawns the player with the custom character. For others, it loads character only once. I made some edits (All of the edits weren’t related to that.). If you want to know why I didn’t use Humanoid.Died:Wait(), see this
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local FAKE_CHAR = ServerStorage['CharName'] -- The character to load, put it in ServerStorage
local RESPAWN_TIME = 2.5 -- How many seconds the player remains dead before they respawn
local ID = 0 --replace 0 with your friends UserID
local diedConns = {}
Players.CharacterAutoLoads = false -- Disable default character loading
local function diedOrLeft(plr, charLoadFunct)
diedConns[plr]:Disconnect()
diedConns[plr] = nil
if charLoadFunct then
wait(RESPAWN_TIME)
charLoadFunct(plr)
end
end
local function loadCustomChar(plr)
local char = FAKE_CHAR:Clone()
char.Name = plr.Name
plr.Character = char
char.Parent = game.Workspace
diedConns[plr] = char.Humanoid.Died:Connect(function()
diedOrLeft(plr, loadCustomChar)
end)
end
local function loadChar(plr)
plr:LoadCharacter()
diedConns[plr] = plr.Character.Humanoid.Died:Connect(function()
diedOrLeft(plr, loadChar)
end)
end
local function playerAdded(plr)
if plr.UserId == ID then
loadCustomChar(plr)
else loadChar(plr)
end
end
game.Players.PlayerAdded:connect(playerAdded)
for i, player in pairs(game.Players:GetPlayers()) do
playerAdded(player)
end
Players.PlayerRemoving:Connect(diedOrLeft)
If you didn’t know, you can have multiple friends as once by doing this:
local id = "0", "1", "2", "3"
Just keep adding ,"0" 's at the end of every one.
Yeah, I posted it and didn’t look at the post. I feel like that Sudden_Demise’s method is the best method, now I’ve read it.