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

How Can We Fix A Tycoon GUI Broken By Roblox Updates?

Asked by 6 years ago

Since An Roblox Update, The GUIs Used For The Tycoon Are Broken. The "Become Owner" Thing And Buttons Doesn't Disappear (Transparent) Unlike Before. In Studio Mode Everything Works Fine But In Roblox Player It Doesn't. On The Dev Console, It Says That The Error Is On Line 32. There's The Script Bellow And Thanks For Helping :)

local main = script.Parent.Parent.Parent
local owner = main.Owner
local tn = main.Parent.TycoonName
local debounce = false

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 p.Tycoon.Value == true then
                    for GuiReveal = 1, 0, -0.05 do
                        p.PlayerGui.TycoonGui.Notice.Text = "You already have a "..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
                owner.Value = p.Name
                p.Tycoon.Value = true
                for GuiReveal = 1, 0, -0.05 do
                    p.PlayerGui.TycoonGui.Notice.Text = "You now own a "..tn.Value..", "..p.Name.."!"
                    p.PlayerGui.TycoonGui.Notice:TweenPosition(UDim2.new(0, 0, 0, 50), Out, Quad, 0.5, false)
                    p.PlayerGui.TycoonGui.Notice.Transparency = GuiReveal
                    wait()
                end
                main.Sign:remove()
                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
                for i = 0.4, 1, 0.02 do
                    wait()
                    script.Parent.Transparency = i
                end
                script.Parent.Parent:remove()
            end
        end
        wait(2)
        debounce = false
    end
end)
0
The reason for that is because the server can not access the player's PlayerGui. You will want to use remote events. Also, :remove and :connect are deprecated, use :Destroy and :Connect. User#19524 175 — 6y
0
So By Using Remote Events And Replacing :remove and :connect Would It Fix The Problem Or I Will Need To Do The Same For The Button's scripts? (The Buttons We Go On To Buy / Unlock Stuff) friendman7000 3 — 6y
0
The remote event will allow for the GUIs to show, and you should replace :connect and :remove them because they are deprecated, and deprecated items should not be used in new work. They can be removed by Roblox at any time, and if that happens your scripts will break. Most important one to not use is :remove though. Using :remove simply sets the parent property to nil, so it still exists. User#19524 175 — 6y
0
:Destroy on the other hand does the same, but it locks the parent property; it can't be reparented. It also prepares the object for garbage collection, and when there' are no more references to the object, it gets garbage collected. User#19524 175 — 6y
View all comments (3 more)
0
You can read more about that here: https://scriptinghelpers.org/blog/do-you-have-zombies-in-your-code they refer to it as a code zombie. User#19524 175 — 6y
0
Wow That Really Well Explained Thanks :D friendman7000 3 — 6y
0
But About Remote Events, Is There A place Or Any tools I Can Use To Learn Using Them? friendman7000 3 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Try updating the script. It might help! Try testing each line seeing if they all work, if a line doesn't work, try to update it to fix it! Hope this helps!

0
Maybe if you mentioned what you meant by "updating", t would help. User#19524 175 — 6y
Ad

Answer this question