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

Why wont this script I duplicated work when it worked before?

Asked by 3 years ago

I made a script that opened and closed a gui every time you clicked a button, it worked. I needed the same script for a different button, so I duplicated the script and put it in a different button and made a few changes to make a different gui appear. For some reason however, the copy of the script wont work, and it gives me an error that says:

CreateTerritoryGui is not a valid member of PlayerGui "Players.Paczki_TCBC.PlayerGui"

(CreateTerritoryGui is the gui I'm trying to make appear, and Paczki_TCBC is my username.)

here is the script that did work:

local Or = 1
local button = script.Parent
local editor = button.Parent.Parent.Editor
editor.Enabled = false

button.MouseButton1Up:Connect(function()
    Or = Or * -1
    if Or == -1 then
        editor.Enabled = true
    elseif Or == 1 then
        editor.Enabled = false

    end
end)

and here is the one that did not work:

local choice = 1
local button = script.Parent
local editor = button.Parent.Parent.CreateTerritoryGui
editor.Enabled = false

button.MouseButton1Up:Connect(function()
    choice = choice * -1
    if choice == -1 then
        editor.Enabled = true
    elseif choice == 1 then
        editor.Enabled = false

    end
end)

0
This could be because the script is trying to find CreateTerritoryGui before it has loaded in try replacing button.Parent.Parent.CreateTerritoryGui with button.Parent.Parent:WaitForChild("CreateTerritoryGui") Trongaming3211 7 — 3y
0
thanks everyone but i figured it out on my own surviarlTheJefkillre 55 — 3y
0
fyi, there is *=, +=, %=, -=, /=, ..=, operators which to the same thing as value = value + value2 0hsa 193 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

i think there is a book gear is able to help get this plugin : https://www.roblox.com/library/997404854/Catalog-Loader? and type 1001541309 in the blue box there is a ui is like a page turns the frame named 1 to framed named two

Ad
Log in to vote
0
Answered by 3 years ago

Make sure there is a thing called CreateTerritoryGui (script.Parent.Parent.Parent.CreateTerritoryGui)

0
there is surviarlTheJefkillre 55 — 3y

Answer this question