#For some reason the gui/button does not delte

81 messages · Page 1 of 1 (latest)

vague thicket
#

i will give script

#
local function createExitGui(player)
    local gui = Instance.new("ScreenGui")
    gui.Name = "ExitGui"

    local button = Instance.new("TextButton")
    button.Size = UDim2.new(0.3, 0, 0.2, 0)
    button.Position = UDim2.new(0.5, 0, 0.5, 0)
    button.BackgroundColor3 = Color3.new(1, 1, 1)
    button.Text = "Click to Exit"
    button.Parent = gui

    gui.Parent = player.PlayerGui

    local UserInputService = game:GetService("UserInputService")

    -- Debounce variable
    local debounce = false

    -- Function to handle button click
    local function onButtonClick()
        -- Check debounce
        if debounce then
            return
        end

        --debounce = true

        -- Remove the player from the index
        for i, p in ipairs(PlayerInGame) do
            if p == player then
                table.remove(PlayerInGame, i)
                print(player.Name .. " removed from PlayerInGame index.")
                break
            end
        end

        -- Teleport player using CFrame
        player.Character:SetPrimaryPartCFrame(CFrame.new(Vector3.new(184.766, 5, 40.706)))

        -- Remove the exit GUI
        
        button:Destroy()

        return
        
    end
mint obsidian
#

you are deleting only the button

#

try deleting whole gui

vague thicket
#

@mint obsidian ok I’ll try that

tiny cairn
#

crazy i was once crazy.

vague thicket
#

what does that even do

tiny cairn
#

prints out this

vague thicket
#

im going to friend you

#

😦

#

fair

tiny cairn
#

dots in random order

#

100 times 100

#

dots in random order

vague thicket
#

that is beyond my scope of understanding

tiny cairn
#

i coudl aslo add some _ in there

#

or letters

#

or even numbers

vague thicket
#

imagine you make a random message gennerator with this

tiny cairn
#

but too much effort

#

uhh

vague thicket
#

too much i concur

tiny cairn
#

it might be possible with roblox

#

its not that hard you can use ifstatments and for loops

#

but i dont know about the random imort

#

depends on lua ig

vague thicket
#

in roblox 🌟 ✨ 🌈 POSIBLE🌈 ✨ 🌟

#

roblox lua has math.random

tiny cairn
#

o than its possdible

#

all you need to do is send it instantly to the thingy instead of adding it to a string

#

like i did

vague thicket
#

trueee but then again idk what you are talking about

#

@tiny cairn can you look at it too

tiny cairn
#

alr

#

appearently

#

its gui:destoy

#

@vague thicket

vague thicket
#

ty

orchid sirenBOT
#

studio** You are now Level 10! **studio

tiny cairn
#

and dies it work?

vague thicket
#

gui:Destroy()

#

@tiny cairn changing that did not change anything either

tiny cairn
#

hmm

vague thicket
#

but

#

when i rapidly click

#

it eventually destroys

#

anything that could explain this

tiny cairn
#

try do it agian

#

but this time

#

2 times

#

so 1 when your inside

#

and 1 when your outside

#

@vague thicket

vague thicket
#

ok

tiny cairn
#

so not rapidly

mint obsidian
#

any errors in the output?

vague thicket
#

not by the looks like

#

also @tiny cairn it didnt change anything

#

would it help to give the whole script

tiny cairn
#

idk

vague thicket
#

k

tiny cairn
#

i think what i have is enough

#

since it destroyed it right but only after a few clicks

#

what if you destroy the button after

#

you click

#

so her

#

e

#

button.MouseButton1Click:Connect(onButtonClick)

mint obsidian
#

make it so it desnt make any more guis if the player already has one

vague thicket
#

ok il try

tiny cairn
#

wait

#

why dont you destroy the button inside the loop

#

so if it found a play that wants to exits it also destros

#

for i, p in ipairs(PlayerInGame) do
if p == player then
-- Teleport the player to a specific location
player.Character:SetPrimaryPartCFrame(CFrame.new(Vector3.new(184.766, 5, 40.706)))
-- Remove the player from the index
table.remove(PlayerInGame, i)
print(player.Name .. " removed from PlayerInGame index.")
-- destroys the button
gui:Destroy()
break
end
end

vague thicket
#

so i just add a break under it

#

ok ill try

#

the reak is shown as red

tiny cairn
#

?