The first time I spawn everything is fine
The second time I spawn I respawn but the camera is focused at my death
The third time I don’t respawn at all
I have no scripts to show as I said I didn’t tinker with the camera and don’t know what’s causing this issue.
I’ve searched the explorer for any possible virus scripts but there aren’t any.
Any support is appreciated thank you!
EDIT: I’ve also noticed after the second time, NPCS stop chasing me
It’s hard to say what the issue is with the little information given. but do you have characterautoloads off? Custom spawning not done properly can cause issues. Also, is your script ever assigning the player a character? (I.e. Player.Character = Model)
Yea the problem is I can’t indentify the issue either, I’m going through most of my scripts and disabling them to see if that would do the trick but no luck so far.
CharacterAutoLoads is set to true as well as there is no custom characters. I do have a script that parents the player character to a folder called “Characters” upon respawn.
Here’s the contents:
Players.PlayerAdded:Connect(function(Player)
local Character = Player.Character or Player.CharacterAdded:Wait()
repeat wait()
Character.Parent = game.Workspace.World.Characters
until Character.Parent == game.Workspace.World.Characters do end
Modules["Datastore"].startData(Player)
Modules["Datastore"].loadData(Player)
Modules["Datastore"].generateObjInstances(Player)
Modules["Character Loader"].loadCharacterTools(Player)
--> Character Resetter
Player.CharacterAdded:Connect(function(Character)
Character.Parent = game.Workspace.World.Characters
Modules["Character Loader"].loadCharacterTools(Player)
end)
end)
EDIT: I just found the issue! The issue lies in:
--> Character Resetter
Player.CharacterAdded:Connect(function(Character)
Character.Parent = game.Workspace.World.Characters
Modules["Character Loader"].loadCharacterTools(Player)
end)
I don’t think it’s the loadCharacterTools since it just parents a tool to the player Backpack.
I’m having the same issue, and I am pretty sure that changing parent of the character actually make it glitchy sometimes. It even makes my character yellow for no reason or change it to all black with no accessories. This is super weird
Hello everyone, today, I’ve came across this issue again and I’ve remembered I’ve posted a question on this on DevForum. I’ve took time to find a solution to this issue and now I want to post this solution to those who may also be having this issue.
The Problem
In both cases, when the character respawn, it is immediately re parented to a Folder known as “Entities”. This is to categorize and reduce iterations for NPC computing. The script may seem like so:
while Character and Character.Parent ~= game.Workspace.Entities do
Character.Parent = game.Workspace.Entities
RunService.Stepped:Wait()
end
The problem is in fact that I’m reparenting the character (seems like I’m doing it too quick for Roblox’s Camera script to detect causing the behavior above.
As some of us who’ve tried this may know, immediately reparenting the character with one line won’t always work. It may look like this:
local RunService = game:GetService("RunService")
game.Players.PlayerAdded:Connect(function(Player)
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild"Humanoid"
Character.Parent = game.Workspace.Entities
--while Character and Character.Parent ~= game.Workspace.Entities do
-- Character.Parent = game.Workspace.Entities
-- RunService.Stepped:Wait()
--end
Player.CharacterAdded:Connect(function(Character)
--wait(5)
local Humanoid = Character:WaitForChild"Humanoid"
Character.Parent = game.Workspace.Entities
end)
end)
The Solution
The solution is to yield first, before iterating and parenting. You can either just manually add a wait(1~) near the top or implement that as the yield duration for iterating. A finished product would look something like this:
game.Players.PlayerAdded:Connect(function(Player)
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild"Humanoid"
while Character and Character.Parent ~= game.Workspace.Entities do
wait(1)
Character.Parent = game.Workspace.Entities
end
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild"Humanoid"
while Character and Character.Parent ~= game.Workspace.Entities do
wait(1)
Character.Parent = game.Workspace.Entities
end
end)
end)
Anyway, I just wanted to solve this issue that I had a while back and hopefully someone may find this information useful.