How would you make a script that would not allow players to respawn when they die until they click a button?

But what if the player buys the respawn dev product?

I’m not sure, maybe enable the death state again, kill the player, and then disable it right after.

local Gui = -- Path to the respawn gui

Gui.MouseButton1Click:Connect(function()
    local Humanoid = --Path to the plauyer's humanoid
    Humanoid:SetStateEnabled(Enum.HumanoidStateType.Death, true)
    Humanoid:ChangeState(Enum.HumanoidStateType.Death)
    Humanoid:SetStateEnabled(Enum.HumanoidStateType.Death, false)
end)

Try to do it like that

wait so you kill the player again, then do that script?

I tried this using Players.CharacterAutoLoads and it works