Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

This script does as I wanted, But only for a short time, Could you give me a hand?

So, This script is to morph a playermodel into a custom model with custom animations 'n' such, Which goes like this:

local morph = game.ReplicatedStorage.Puro --Replace with path to desired Morph
local pad = script.Parent

pad.Touched:connect(function(hit)
    local par = hit.Parent
    if par.ClassName == "Model" then
	local transfured = par:FindFirstChildWhichIsA("BoolValue")
	if transfured.value == false then
        local hum = par:FindFirstChild("Humanoid")
        if hum then
            local ply = game.Players:GetPlayerFromCharacter(par)
            if ply then
                local morphClone = morph:Clone()
                morphClone.Name = par.Name
                morphClone.Parent = game.Workspace
                morphClone.PrimaryPart.CFrame = par.PrimaryPart.CFrame
				ply.Character = morphClone
				wait(0.5)
				local Animator = morphClone:FindFirstChild("Animator")
				Animator.Disabled = false
				local Dyez = morphClone:FindFirstChild("CommitDyez")
				Dyez.Disabled = false
				game.Workspace.EVENTS["AnimationChange (Puro)"]:FireClient(hit)
			end
            end
        end
    end
end)

The thing is; After the character morphs, 3 seconds later, The character respawns, What I assume that happens is that the model switch makes the game think that the character has died, And is soon going to respawn it.

So, Uh, The question is: How do I stop this? It's just the ONLY thing that doesn't let my morph script to work.

2 answers

in the touched event do this at the end of it

hum.Died:Connect(function()
wait(3)
 local morphClone = morph:Clone()
                morphClone.Name = par.Name
	                morphClone.Parent = game.Workspace
	                morphClone.PrimaryPart.CFrame = par.PrimaryPart.CFrame
	                ply.Character = morphClone
	                wait(0.5)
	                local Animator = morphClone:FindFirstChild("Animator")
	                Animator.Disabled = false
	                local Dyez = morphClone:FindFirstChild("CommitDyez")
	                Dyez.Disabled = false
	                game.Workspace.EVENTS["AnimationChange (Puro)"]:FireClient(hit)

end)

2 comments

0

should work// havent tested

0

The same problem happens.

local morph = game.ReplicatedStorage.Puro --Replace with path to desired Morph
local pad = script.Parent

pad.Touched:connect(function(hit)
    local par = hit.Parent
    if par.ClassName == "Model" then
    local transfured = par:FindFirstChildWhichIsA("BoolValue")
    if transfured.value == false then
        local hum = par:FindFirstChild("Humanoid")
        if hum then
            local ply = game.Players:GetPlayerFromCharacter(par)
            if ply then
                local morphClone = morph:Clone()
                morphClone.Name = par.Name
                morphClone.Parent = game.Workspace
                morphClone.PrimaryPart.CFrame = par.PrimaryPart.CFrame
                ply.Character = morphClone
                wait(0.5)
                local Animator = morphClone:FindFirstChild("Animator")
                Animator.Disabled = false
                local Dyez = morphClone:FindFirstChild("CommitDyez")
                Dyez.Disabled = false
                game.Workspace.EVENTS["AnimationChange (Puro)"]:FireClient(hit)
        wait(8)
    end
end

3 comments

0

Explain your answer - don't just post code.

0

Yeah!, I'd like to know how to fix stuff instead of being told.

0

Same problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.