Cannot Reset Character with Custom Rig

Another day, another bug haunting me like a terrible sin


Straight to the point, making a bunny game, a script LoadCharacter()'s you and gives you a new character

		local cf = character:GetPivot()
		local newgubby = ServerStorage.bunny:Clone()
		newgubby.Parent = StarterPlayer
		newgubby.Name = "StarterCharacter"
		player:LoadCharacter()
		newgubby:Destroy()

everythings fine but i cant reset, this is literally annoying.
does anybody know a solution to this problem that will drive me insane for years

No need for that. Your character change steps should be as follows:

  • optionally set the new Character’s CFrame
  • set the new Character.Parent to workspace
  • Set the player’s character to the new Character
  • Delete the old Character (stored in a variable)

Alright fiiine ill do it thanks

You’ll probably have to implement custom respawning logic.

local StarterGui = game:GetService("StarterGui")

local function resetButtonCallback()
	-- Handle resetting here (loading character, clean up, etc.)
end

-- In case ResetButtonCallback hasn't been registered yet.
while not pcall(
StarterGui.SetCore, StarterGui,
"ResetButtonCallback", resetButtonCallback
) do task.wait() end

Instead of setting the bunny as a starter character, you can set the player’s character directly to the bunny and load them. Skeleton of what im thinking:

local bunny = …
character = bunny
bunny.Parent = workspace 
loadcharacter

this didnt help me remove the “cant respawn” problem unfortunately, i thought itd do smth

You need to implement custom respawning logic for custom characters.

local StarterGui = game:GetService("StarterGui")
local Players = game:GetService("Players")
local ResetBindable = Instance.new("BindableEvent")

ResetBindable.Event:Connect(function()
	local Character = Players.LocalPlayer.Character
	local Humanoid = Character:FindFirstChildOfClass("Humanoid")
	if Character and Humanoid then
		Humanoid.Health = 0
	end
end)

while task.wait() do
	local success, _ = pcall(function()
		return StarterGui:SetCore("ResetButtonCallback", ResetBindable)
	end)
end

thaanks this worked!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.