I found that the character is not respawning whiile I did set CharacterAutoLoad to true and did not do anything about Character's death. There is only script that changes the character's Parent
local Players = game:GetService("Players") Players.PlayerAdded:Connect(function (plr) plr.CharacterAdded:Connect(function (chr) chr = chr or plr.CharacterAdded:Wait() chr:WaitForChild("HumanoidRootPart") chr.Parent = workspace.Folder print(chr.Parent) while true do print (chr.Parent) wait(1) end end) end)
outputs are like :
Folder
Folfder
Workspace
Workspace ...........Workspace
How can I assign character's Parent correctly not using wait(1) then Parent it to other?
The problem is because when the character dies, the game will automatically reset the player's character into workspace instead of the folder. One way to fix this is to add a function to check for the player character's humanoid state so that when it dies, you can add a wait() function to wait for the character to spawn then add the character to the folder after.
You may refer to the following:
https://developer.roblox.com/en-us/api-reference/enum/HumanoidStateType
First, make a remote event in replicated storage
and then
-- script local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent") game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(chr) wait() chr.Parent = workspace:WaitForChild("Folder") RemoteEvent:FireClient(plr) end) end) -- local script local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent") RemoteEvent.OnClientEvent:Connect(function() workspace.CurrentCamera.CameraSubject = game.Players.localplayer.Character:WaitForChild("HumanoidrootPart") end)
if it still doesn't work, dm me at