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

Tycoon regenerating script? (Need a bit help with the cloning part)

Asked by
lomo0987 250 Moderation Voter
9 years ago

I know there are free scripts for this, but i'm creating everything myself. (even if it isn't as efficient as it can be..)

But anyways.. I don't exactly understand how I can set up the clone to get the original tycoon and have it spawn after the player leaves for the tycoon.. I did a few tests and they didn't exactly work, it removed the tycoon, just didn't spawn the tycoon..

brick = script.Parent
name = script.Parent.Parent
owner = script.Parent.Parent.Parent.Owner
tycoon = script.Parent.Parent.Parent.Parent

brick.Touched:connect(function (hit)
    plr = hit.Parent
    player = game.Players:FindFirstChild(plr.Name)
    repeat wait() until player
    tycoon = player:FindFirstChild("Tycoon")
    repeat wait() until tycoon
        if tycoon.Value < 1 then
            if owner.Value == "" then
                tycoon.Value = 1
                owner.Value = plr.Name
                name.Name = owner.Value.."'s Tycoon!"
            for i = 1, 10 do
                brick.Transparency = brick.Transparency + 0.089
                wait(.1)
            end
        end
    end
end)
game.Players.PlayerAdded:connect(function ()
    if owner.Value == "" then
        name.Name = "Touch to claim this tycoon!"
    end
end)

game.Players.PlayerRemoving:connect(function (plr)
    if plr.Name == owner.Value then
        tycoon:Clone()
        script.Parent.Parent.Parent.Parent:remove()
        tycoon.Parent = game.Workspace
        owner.Value = ""
        name.Name = "Touch to claim this tycoon!"
        brick.Transparency = 0
    end
end)
0
Try this tycoon:clone().Parent = (What ever you want the parent to be) I'm not exactly sure what the issue is. Please explain if this does not solve it Bman8765 270 — 9y
0
If I did that, wouldn't it make it so it gets spawned then the tycoon gets deleted? and I already did state what was wrong with it... "It removes the tycoon, just didn't spawn the tycoon" lomo0987 250 — 9y

Answer this question