I have a system where when players die, they do not respawn automatically (Players.CharacterAutoLoads = false) and when the player joins, it automatically loads them using plr:LoadCharacter()
When the character dies, I have a spectate gui set up and working which allows them to spend robux to revive themselves. When I revive them using plr:LoadCharacter(), the first respawn works fine but when I try die and revive again, the player respawns but is unable to move.
I’ve checked for many possible solutions but none came up. I tried replicating this in a normal baseplate and then it works normally.
Here’s the code I used to revive:
local function revive(player:Player)
local deadChar = player.Character
if deadChar.Humanoid.Health > 0 then return end
local deathPos = deadChar.HumanoidRootPart.Position
player:LoadCharacter()
local char = player.Character or player.CharacterAdded:Wait()
task.wait()
char:MoveTo(deathPos)
end
local function revive(player:Player)
local deadChar = player.Character
if deadChar.Humanoid.Health > 0 then return end
local deathPos = deadChar.HumanoidRootPart.CFrame
player:LoadCharacter()
local char = player.Character or player.CharacterAdded:Wait()
task.wait()
char.HumanoidRootPart.CFrame = deathPos
end
I’ve tried this but it made no difference. I also checked if anything is anchored but nope. I also tried the code without teleporting the player back to the death location but that also didn’t work. First revive works, the second doesn’t for some reason.
As you said it works fine on a normal baseplate, maybe the problem is caused by the other script?
Also if you want to guarantee that the whole character is moved correctly you could use char:PivotTo((CFrame.new) + deathPos)
I figured out the issue, in another local script where I used to disable all custom ContextActionService buttons I made, I used the ContextActionService:UnbindAllActions() for it. Doing this resulted in all my movement keys being disabled too.