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

Why wont this gui work?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
wait()
local debounce = false -- A code that keeps a function from running too many times (Don't touch that, it'll break otherwise)
local main = script.Parent.Parent.Parent
local owner = main.Owner
local income = main.Income
local tn = main.Parent.TycoonName
local price = 150 -- Price of the income upgrade (You can change the price if you want)
local priceadd = 150 -- How much money is added when the cilent upgrades the income
local incomeadd = 5 -- How much income is added when the cilent upgrades the income
local times = 1 -- How many times you can upgrade your income before it disappears
local dv = game.Workspace.Tycoon.DataValues


script.Parent.Touched:connect(function(hit)
    if (debounce == false) then
        debounce = true
        local h = hit.Parent:FindFirstChild("Humanoid")
        if (h ~= nil) then
            local p = game.Players:FindFirstChild(hit.Parent.Name)
            if (p ~= nil) then
                if owner.Value ~= p.Name then
                    for GuiReveal = 1, 0, -0.05 do
                        p.PlayerGui.TycoonGui.Notice.Text = "You are not the owner of this "..tn.Value.."!"
                        p.PlayerGui.TycoonGui.Notice:TweenPosition(UDim2.new(0, 0, 0, 50), Out, Quad, 0.5, false)
                        p.PlayerGui.TycoonGui.Notice.Transparency = GuiReveal
                        wait()
                    end
                    wait(3)
                    for GuiReveal = 0, 1, 0.15 do
                        p.PlayerGui.TycoonGui.Notice:TweenPosition(UDim2.new(-1.2, 0, 0, 50), Out, Quad, 0.5, false)
                        p.PlayerGui.TycoonGui.Notice.Transparency = GuiReveal
                        wait()
                    end
                    wait(2)
                    debounce = false
                return end
                if p.leaderstats.Money.Value < price then
                    for GuiReveal = 1, 0, -0.05 do
                        p.PlayerGui.TycoonGui.Notice.Text = "You cannot afford this! You need $"..price - p.leaderstats.Money.Value.." more to upgrade income!"
                        p.PlayerGui.TycoonGui.Notice:TweenPosition(UDim2.new(0, 0, 0, 50), Out, Quad, 0.5, false)
                        p.PlayerGui.TycoonGui.Notice.Transparency = GuiReveal
                        wait()
                    end
                    wait(3)
                    for GuiReveal = 0, 1, 0.15 do
                        p.PlayerGui.TycoonGui.Notice:TweenPosition(UDim2.new(-1.2, 0, 0, 50), Out, Quad, 0.5, false)
                        p.PlayerGui.TycoonGui.Notice.Transparency = GuiReveal
                        wait()
                    end
                    wait(2)
                    debounce = false
                return end
                        '           
                if dv.IncomeProgress.Value == 0 then
                    for GuiReveal = 1, 0, -0.05 do
                    p.PlayerGui.TycoonGui.Notice.Text = "Zero"
                return end
                '
                if p.leaderstats.Money.Value >= price then
                    p.leaderstats.Money.Value = p.leaderstats.Money.Value - price
                    price = price + priceadd
                    income.Value = income.Value + incomeadd
                    script.Parent.Parent.Name = "Upgrade Income - $"..price
                    for GuiReveal = 1, 0, -0.05 do
                        p.PlayerGui.TycoonGui.Notice.Text = "Income upgraded! Your salary is now $"..income.Value.."!"
                        p.PlayerGui.TycoonGui.Notice:TweenPosition(UDim2.new(0, 0, 0, 50), Out, Quad, 0.5, false)
                        p.PlayerGui.TycoonGui.Notice.Transparency = GuiReveal
                    end
                    wait(3)
                    for GuiReveal = 0, 1, 0.05 do
                        p.PlayerGui.TycoonGui.Notice:TweenPosition(UDim2.new(-1.2, 0, 0, 50), Out, Quad, 0.5, false)
                        p.PlayerGui.TycoonGui.Notice.Transparency = GuiReveal
                    end
                    if times > 0 then
                        times = times - 1
                    else
                        if times == 0 then
                            for i = 0.4, 1, 0.01 do
                                script.Parent.Transparency = i
                                wait()
                            end
                            script.Parent.Parent:Remove()
                        end
                    end
                end
            end
        end
        wait(2)
        debounce = false
    end
end)
0
Line 54 - 57 is the issue. Loterman23 10 — 9y

1 answer

Log in to vote
2
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

Lines 53 and 58 have nothing but a ' on them so the script can't compile. You should read the output and post it rather than just copying and pasting some script and telling strangers it's broken. Line 54 has no end. "return end" on line 57 is closing the for loop on line 55.

0
the ' was put in intentionally thinking it would highlight that block, as for the second part... that would make a lot of sense, thank you, i'll give that a shot. Loterman23 10 — 9y
Ad

Answer this question