Ad
Log in to vote
0

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

Asked by 14 days 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 — 14d
0
thanks everyone but i figured it out on my own surviarlTheJefkillre 38 — 14d
0
fyi, there is *=, +=, %=, -=, /=, ..=, operators which to the same thing as value = value + value2 0hsa 119 — 14d

2 answers

Log in to vote
0
Answered by 14 days 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 14 days ago

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

0
there is surviarlTheJefkillre 38 — 14d

Answer this question