Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago

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)
0
should work// havent tested mattchew1010 396 — 5y
0
The same problem happens. Chris75764 49 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
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
0
Explain your answer - don't just post code. SummerEquinox 643 — 5y
0
Yeah!, I'd like to know how to fix stuff instead of being told. Chris75764 49 — 5y
0
Same problem. Chris75764 49 — 5y

Answer this question