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 6 years ago

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

01local morph = game.ReplicatedStorage.Puro --Replace with path to desired Morph
02local pad = script.Parent
03 
04pad.Touched:connect(function(hit)
05    local par = hit.Parent
06    if par.ClassName == "Model" then
07    local transfured = par:FindFirstChildWhichIsA("BoolValue")
08    if transfured.value == false then
09        local hum = par:FindFirstChild("Humanoid")
10        if hum then
11            local ply = game.Players:GetPlayerFromCharacter(par)
12            if ply then
13                local morphClone = morph:Clone()
14                morphClone.Name = par.Name
15                morphClone.Parent = game.Workspace
View all 28 lines...

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 6 years ago

in the touched event do this at the end of it

01hum.Died:Connect(function()
02wait(3)
03 local morphClone = morph:Clone()
04                morphClone.Name = par.Name
05                    morphClone.Parent = game.Workspace
06                    morphClone.PrimaryPart.CFrame = par.PrimaryPart.CFrame
07                    ply.Character = morphClone
08                    wait(0.5)
09                    local Animator = morphClone:FindFirstChild("Animator")
10                    Animator.Disabled = false
11                    local Dyez = morphClone:FindFirstChild("CommitDyez")
12                    Dyez.Disabled = false
13                    game.Workspace.EVENTS["AnimationChange (Puro)"]:FireClient(hit)
14 
15end)
0
should work// havent tested mattchew1010 396 — 6y
0
The same problem happens. Chris75764 49 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
01local morph = game.ReplicatedStorage.Puro --Replace with path to desired Morph
02local pad = script.Parent
03 
04pad.Touched:connect(function(hit)
05    local par = hit.Parent
06    if par.ClassName == "Model" then
07    local transfured = par:FindFirstChildWhichIsA("BoolValue")
08    if transfured.value == false then
09        local hum = par:FindFirstChild("Humanoid")
10        if hum then
11            local ply = game.Players:GetPlayerFromCharacter(par)
12            if ply then
13                local morphClone = morph:Clone()
14                morphClone.Name = par.Name
15                morphClone.Parent = game.Workspace
View all 26 lines...
0
Explain your answer - don't just post code. SummerEquinox 643 — 6y
0
Yeah!, I'd like to know how to fix stuff instead of being told. Chris75764 49 — 6y
0
Same problem. Chris75764 49 — 6y

Answer this question