Hi, i currently have a script that clones my receipts onto a menu board but whilst doing so it makes a button that says “DONE” visible. Im trying to work out how i can make the DONE button delete the surface GUI from the screen. It keeps giving me errors since the text button isnt a member of the OrderScreen Surface GUI, instead it just gets cloned into it when the receipt does.
Events.Checkout.OnServerEvent:Connect(function (Player, Order)
CustomerScreen.Order.Visible = false
CustomerScreen.Checkout.Visible = true
local Receipt = game.ServerStorage.Receipt.Receipt.Receipt:Clone()
local BindableEvent = game.Workspace.Tech.Events.BindableEvent
Receipt.Order.Text = Order
Receipt.Parent = game.Workspace.OrderScreenGui
Receipt.TextButton.Visible = true
end)
Heres my code that clones the receipt onto the screen as well as making the done button visible.
This Order board is located in workspace?(How does it work, Is that intentional) I was going to tell you that you shouldn’t be changing clientside UI via Serverside remotes. but I’m not entirely sure what’s going on with your system.
Currently when i play the game i dont get any errors. When i create an order on my cash register, the player is given a receipt as a tool in their backpack and the receipt also appears on the order screen with a “Done” button. But im looking to know how id make the DONE button remove the order from the main screen and whenever i try to code something to do so, it causes errors.
So I figured just add the done button onto this already existing function instead of making more clutter n scripts
This is what you have right now…
Receipt.TextButton.Visible = true
This is what I suggest doing
Receipt.TextButton.Visible = true
local DoneFunction
DoneFunction = Receipt.TextButton.MouseButton1Click:Connect(function() --// Might need different event idk
-- I might add something here idk (._.
DoneFunction:Disconnect()
--//Discard Reciept Receipt:Destroy() or game.Debris:AddItem(Receipt,.1)
end)