#For some reason the gui/button does not delte
81 messages · Page 1 of 1 (latest)
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 ok I’ll try that
what does that even do
prints out this
that is beyond my scope of understanding
imagine you make a random message gennerator with this
too much i concur
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
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
trueee but then again idk what you are talking about
@mint obsidian I made the change you told me to do but it didnt change anything
@tiny cairn can you look at it too
ty
** You are now Level 10! **
and dies it work?
hmm
but
when i rapidly click
it eventually destroys
anything that could explain this
try do it agian
but this time
2 times
so 1 when your inside
and 1 when your outside
@vague thicket
ok
so not rapidly
any errors in the output?
not by the looks like
also @tiny cairn it didnt change anything
would it help to give the whole script
idk
k
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)
make it so it desnt make any more guis if the player already has one
ok il try
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
?