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

Problem with swapping characters (welding parts)?

Asked by 4 years ago
Edited 4 years ago

I am using a script in my game that was made by someone else a long time ago. The script should change the person (wearing 'Nature Outfit') to a person (wearing 'Chaos Nature Outfit')

It is a local script inside a tool. When you click this tool, you should change into the other 'character'. This works, but it teleports you to the location of 'Chaos Nature', the other outfit in Lighting.

I have another tool with two other characters and these work just fine. Even though the script is 99% the same.

Can someone figure out how I can get Chaos Form nature to change on my current position, without teleporting me to it's Lighting.location? Click here for a Youtube Demonstration

local player = script.Parent.Parent.Parent
function onButton1Down(mouse)

if script.Parent.species.Value == "Death" then
script.Parent.Name = ("Transform back")
script.Parent.species.Value = "Chaos Form"
    local effect = Instance.new("Part")
        effect.Parent = player.Character
        effect.Name = "ChangeEffect"
        effect.FormFactor = "Symmetric"
        effect.Size = Vector3.new(2,2,2)
        effect.BrickColor = BrickColor.new("Really black")
        effect.CFrame = player.Character["Torso"].CFrame
        effect.Transparency = 0.3
        local W = Instance.new("Weld")
        W.Part0 = effect
        W.Part1 = player.Character.Torso
        W.Parent = effect
local mesh = Instance.new("SpecialMesh")
        mesh.Parent = effect
        mesh.MeshType = "FileMesh"
        mesh.MeshId = "http://www.roblox.com/asset/?id=1323306"
        mesh.Scale = Vector3.new(3,1,3)
wait(0.2)
    player.Character.Chest:remove()
    player.Character.Arm1:remove()
    player.Character.Arm2:remove()
    player.Character.Leg1:remove()
    player.Character.Leg2:remove()
            local g = game.Lighting["ExtraHum"]:findFirstChild("Chaos Form Nature").Chest:clone()
        g.Parent = player.Character
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = player.Character.Torso
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end
        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end
        local g = game.Lighting["ExtraHum"]:findFirstChild("Chaos Form Nature").Arm1:clone()
        g.Parent = player.Character
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = player.Character["Left Arm"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end
        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end
        local g = game.Lighting["ExtraHum"]:findFirstChild("Chaos Form Nature").Arm2:clone()
        g.Parent = player.Character
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = player.Character["Right Arm"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end
        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end
        local g = game.Lighting["ExtraHum"]:findFirstChild("Chaos Form Nature").Leg1:clone()
        g.Parent = player.Character
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = player.Character["Left Leg"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end
        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end
        local g = game.Lighting["ExtraHum"]:findFirstChild("Chaos Form Nature").Leg2:clone()
        g.Parent = player.Character
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = player.Character["Right Leg"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end
        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end 
player.Character.Head.Transparency = 1
effect:remove()
elseif script.Parent.species.Value == "Chaos Form" then
    script.Parent.Name = ("Chaos Form")
    script.Parent.species.Value = "Death"
    player.Character.Chest:remove()
    player.Character.Arm1:remove()
    player.Character.Arm2:remove()
    player.Character.Leg1:remove()
    player.Character.Leg2:remove()
            local g = game.Lighting["Nature God"]:findFirstChild("Nature God").Chest:clone()
        g.Parent = player.Character
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = player.Character.Torso
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end
        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end
        local g = game.Lighting["Nature God"]:findFirstChild("Nature God").Arm1:clone()
        g.Parent = player.Character
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = player.Character["Left Arm"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end
        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end
        local g = game.Lighting["Nature God"]:findFirstChild("Nature God").Arm2:clone()
        g.Parent = player.Character
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = player.Character["Right Arm"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end
        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end
        local g = game.Lighting["Nature God"]:findFirstChild("Nature God").Leg1:clone()
        g.Parent = player.Character
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = player.Character["Left Leg"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end
        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end
        local g = game.Lighting["Nature God"]:findFirstChild("Nature God").Leg2:clone()
        g.Parent = player.Character
        local C = g:GetChildren()
        for i=1, #C do
            if C[i].className == "Part" then
                local W = Instance.new("Weld")
                W.Part0 = g.Middle
                W.Part1 = C[i]
                local CJ = CFrame.new(g.Middle.Position)
                local C0 = g.Middle.CFrame:inverse()*CJ
                local C1 = C[i].CFrame:inverse()*CJ
                W.C0 = C0
                W.C1 = C1
                W.Parent = g.Middle
            end
                local Y = Instance.new("Weld")
                Y.Part0 = player.Character["Right Leg"]
                Y.Part1 = g.Middle
                Y.C0 = CFrame.new(0, 0, 0)
                Y.Parent = Y.Part0
        end
        local h = g:GetChildren()
        for i = 1, # h do
            h[i].Anchored = false
            h[i].CanCollide = false
        end 
            player.Character.Head.Transparency = 1
        end
end 
        function onSelected(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
        end 
script.Parent.Selected:connect(onSelected)

Answer this question