Character Respawn and Invisible Character Problem

Hello!

I have a problem about character respawn. I have an experience including some power-ups like; bomb, fire etc.
It doesn’t happen every time but; sometimes after the bomb explosion, character respawns invisible on the server side. (Client side is normal)

I don’t use any custom characters or any custom respawn technique. I’ve tried so far; default Roblox respawn and Player:LoadCharacter(), but bug persists.

Any help or ideas are welcome, thanks!

4 Likes

How are you killing the player? Does the bomb just set their health to 0 if they are in a certain range of it?

Could we see some code so we could actually help please?

Make sure when you kill the character, that you aren’t doing
Character:Destroy()

1 Like

It’s a tweened size of a sphere part (like an explosion range).

Code is;

function onTouched(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if hit.Parent.Humanoid.Health == 0 or hit.Parent:FindFirstChild("ForceField") ~= nil then return end
		hit.Parent.Humanoid.Health = 0
	end
end

script.Parent.Touched:connect(onTouched)

This code looks quite old, what’s the current value of the RespawnTime property?

3 seconds. Humanoid.Health = 0 is old? I think it’s not deprecated?

Just the function in general (reminiscent of scripts from over a decade ago), it’s old but not deprecated.

I don’t believe this is the cause of your issue either.

Have you tried killing the player on the client?

Touch Event Script:

local PService = game:GetService("Players")
local KillRemote = game:GetService("ReplicatedStorage"):WaitForChild("KillPlayer")

function onTouched(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if hit.Parent.Humanoid.Health == 0 or hit.Parent:FindFirstChild("ForceField") ~= nil then return end

local Player = PService:GetPlayerFromCharacter(hit.Parent)
		KillRemote:FireClient(Player)
	end
end

script.Parent.Touched:Connect(onTouched) -- using ':connect' is deprecated, use :Connect instead

Client Script:

local Player = game:GetService("Players").LocalPlayer

local character = player.Character
if not character or not character.Parent then
    character = player.CharacterAdded:wait()
end

local KillRemote = game:GetService("ReplicatedStorage"):WaitForChild("KillPlayer")

KillRemote.OnClientEvent:Connect(function()
local H = character:FindFirstChildWhichIsA("Humanoid")

H.Health = 0
end)

Hope this helps!

1 Like

I’ll try that for a long term (because it’s a rare bug). And I’ll let you know if it works well, thanks!

1 Like

Unfortunately, that doesn’t work either. The problem persists.

That’s weird.

Have you tried checking the scripts that handle checking if the Character has been added (e.g scripts that put a billboard gui or something like that)? There might be a rare error in one of them which breaks the Character loading in.

1 Like

I checked them before this message and I realised it’s triggering itself more than once. I fixed it now, I need to try that for a long term again. Then I’ll mark your message as solution. Thanks!

1 Like

Unfortunately, the problem persists.

That’s really weird.

If I were you then I’d try double checking the character scripts once again, or any script at all which edits the character at all, if not that then I don’t know what to say.

I doubt that this is a Roblox issue as this isn’t happening in any other game.

Maybe try DMing me on Discord and I’ll try helping as much as I can there, as talking on the forums can take hours for responses and has many limitations;

Tal#9725

Actually I deleted all the scripts which edits character but it’s still same. And the challenging thing is; it’s not happening all the time.

Have you seen the problem happen for yourself? If so try checking the console for the both clients with the (client and server).

No, never happened to me. I tried it so many times.

If I were you then I’d host maybe an event with some developer friends that you trust where the server is full or nearly full and you all just kill each other until the invisible thing happens. Then you tell them to check their consoles and then the answer will be there.

1 Like

We tested it with more people and with the bomb power up. Then someone went invisible but no server side or client side error printed. Then we realised it’s happening because of the character is not fully reseted after losing some limbs. It’s happening far side of the bomb’s radius. So I think I can fix that after this information. Thanks for helping! (I’m marking your message as solution)

UPDATE: It’s fixed!

1 Like