:LoadCharacter() interfering with respawn

I have a combat game, and I am using the :LoadCharacter() line for my main menu, but I have a problem, when the player dies, they never respawn…

Here’s my death script that doesn’t work at the moment:

local replicatedStorage = game:GetService("ReplicatedStorage")
local lightning = game:GetService("Lighting")
local tweenService = game:GetService("TweenService")
local players = game:GetService("Players")

local deathmessages = {"You Died.", "You died!","Don't worry!",
	"Aurghhhh","WHAT WAS THAT?!","Did you just die?",
	"That's Crazy!",
	"Ye hath yeed yer last haw.",
	"???","Why did that happen?",
	"Oops...","Embarrassing...","I think you just died...",
	"Huh..?","GAME OVER!","That did not just happen."}

local respawn = game.Players.RespawnTime

local respawnEvent = replicatedStorage.Respawn

local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local blur = lightning.DeathBlur
local cc = lightning.DeathCC

local main = script.Parent.Main
local middleFrame = main.MiddleFrame
local title = middleFrame.Title
local rsTitle = middleFrame.RSTitle

title.TextTransparency = 1
middleFrame.BackgroundTransparency = 1
middleFrame.Size = UDim2.new(0, 0,0.128, 0)
middleFrame.Position = UDim2.new(.5, 0,0.393, 0)

local DeathMessage = deathmessages[math.random(1, #deathmessages)]

humanoid.Died:Connect(function()
	
	title.Text = DeathMessage
	
	middleFrame:TweenSizeAndPosition(UDim2.new(1, 0,0.128, 0), UDim2.new(0, 0,0.393, 0))
	tweenService:Create(middleFrame, TweenInfo.new(1), {BackgroundTransparency = 0.4}):Play()
	tweenService:Create(title, TweenInfo.new(1), {TextTransparency = 0}):Play()
	tweenService:Create(rsTitle.UIStroke, TweenInfo.new(1), {Transparency = 1}):Play()
	tweenService:Create(rsTitle, TweenInfo.new(1), {TextTransparency = 0}):Play()
	tweenService:Create(rsTitle.UIStroke, TweenInfo.new(1), {Transparency = 0}):Play()
	tweenService:Create(blur, TweenInfo.new(1), {Size = 20}):Play()
	tweenService:Create(cc, TweenInfo.new(1), {Saturation = -1}):Play()
	
	task.wait(4.5) --respawn time
	respawnEvent:FireServer()

	middleFrame:TweenSizeAndPosition(UDim2.new(0, 0,0.128, 0), UDim2.new(.5, 0,0.393, 0))
	tweenService:Create(middleFrame, TweenInfo.new(0.7), {BackgroundTransparency = 1}):Play()
	tweenService:Create(title, TweenInfo.new(0.7), {TextTransparency = 1}):Play()
	tweenService:Create(title.UIStroke, TweenInfo.new(0.7), {Transparency = 1}):Play()
	tweenService:Create(rsTitle, TweenInfo.new(0.7), {TextTransparency = 1}):Play()
	tweenService:Create(rsTitle.UIStroke, TweenInfo.new(0.7), {Transparency = 1}):Play()
	tweenService:Create(blur, TweenInfo.new(0.7), {Size = 0}):Play()
	tweenService:Create(cc, TweenInfo.new(0.7), {Saturation = 0}):Play()
end)
1 Like

I’m not sure if this would be the case, but as this is on a localscript, are the changes actually replicating to the server? Could you check to see if the game registers the player as ‘KO’d’ on the server?

Like with another script? Like using the event?

Correct. I believe you may be able to connect the humanoid.died event. Using the same method you use to KO the character, there mgiht be a correlation.