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

Custom Paint Job on Regenerating Free Model Not Staying?

Asked by 8 years ago

So I have a free model airplane that uses a regenerating script with a button. I wanted to do custom paint jobs for the fact of it will be a aerial warfare game. Problem is, when i was in Studio, I did the paint job, went into testing mode, and pressed the regen button to see if it would save the changes or not, it reverted back to original color. Is there a way to change the script to make it to where it regenerates with my custom paint job?

Regen Script-

local PlaneClone = script.Parent.Plane:Clone()
local Planekit = script.Parent
PlaneClone.Origin.Value = Planekit
script.Parent.Plane.Origin.Value = Planekit
local EnterOnSpawn = Planekit.EnterOnSpawn
local Button = Planekit.Button
local Main = Button.Main
local RegenGui = script.RegenGui
local PlaneClone2 = nil
local Active = true
--------------------------------------------------------
local RegenTime = 1 --Change this to how long it takes the plane to regen
local WaitTime = 5 --Change this to how much time you have to wait before you can regen another plane
--------------------------------------------------------
function DeleteIdlePlane() --This deletes any planes that aren't currently being used
    for _,v in pairs(Planekit:GetChildren()) do
        if v.Name == "Plane" then
            v:Destroy()
        end
    end
end

function RegenMain() --This function regens the plane
    local PlaneClone2 = PlaneClone:clone()
    PlaneClone2.Parent = Planekit
    PlaneClone2.Origin.Value = Planekit
    PlaneClone2:MakeJoints()
    return PlaneClone2
end

function RegeneratePlane(Part) --This is the main regenerating function
    local Player = game.Players:GetPlayerFromCharacter(Part.Parent) --This gets the player that touched it
    if Player then
        local Humanoid = Player.Character:FindFirstChild("Humanoid")
        if Humanoid.Health ~= 0 then
            if Active then
                Active = false
                DeleteIdlePlane() --This activates the "DeleteIdlePlane" function
                for i = 0,1,0.2 do --This makes the button transparent
                    Main.Transparency = i
                    wait()
                end
                if RegenTime >= 1 then
                    RegenGui.Parent = Player.PlayerGui --The regengui will be put into the player if the regentime is more than 1
                end
                wait(RegenTime)
                RegenGui.Parent = script --This puts the gui back in the script
                local PlaneClone2 = RegenMain()
                if EnterOnSpawn.Value then --If the EnterOnSpawn value is true...
                    coroutine.resume(coroutine.create(function()
                        repeat wait() until PlaneClone2.Welded.Value
                        while true do
                            if PlaneClone2.Welded.Value
                            or Humanoid.Health == 0 then
                                break
                            end
                            wait()
                        end
                        onPlaneWelded(Player,PlaneClone2) --This activates the "onPlaneWelded" function whenever the welded value changes
                    end))
                end
                wait(WaitTime)
                for i = 1,0,-0.2 do --This makes the button visible
                    Main.Transparency = i
                    wait()
                end
                Active = true
            end
        end
    end
end

function onPlaneWelded(Player,Plane) --This function put you into the plane seat the moment the plane is welded
    if Plane and Player then --This checks to make sure there is a plane and a player
        if Player.Character:FindFirstChild("Torso") then
            if Player.Character.Humanoid.Health ~= 0 then
                Player.Character.Torso.CFrame = Plane.MainParts.Seat.CFrame
            end
        end
    end
end

Main.Touched:connect(RegeneratePlane) --This activates the "RegeneratePlane" function when the Main brick is touched
0
What plane kit is this? InfinitivePixelsJr 542 — 8y
0
TurboFusions Plane kit used in the CAP Cessna 172 C by SkyTargeter armyman008 0 — 8y
0
There is indeed. Good luck figuring it out! If you have problems along the way we'll be happy to help, but we will not do this for you. Good Luck! User#11440 120 — 8y

Answer this question