The script is working just one time (or atleast)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Hello guys! I’m Ruben, and I’m trying to make that if someone send the order in the screen, and click the button, the order will be claimed, and if re-clicked again completed (this works and that’s ok!)

  2. What is the issue? But if I try to re-make another order, the gui spawn because it get cloned, but the text disappear, so it makes my text variable says that there is no text.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Yes.

It’s complicated of it works, but I will explain there.

Remote Event create the gui → If the staff click the button (with a script) it sends the Remote Event → The Remote Event in Local Script send another Remote Event, that contains the Local Player information → the Remove Event fill the text in the screen, with who claimed the order and make the red frame visible (player information)

Screen that receive the order from the computer.

 local Ev = game.ReplicatedStorage.McOrderSystem.SendOrder
local Template = script.Order
	
Ev.OnServerEvent:Connect(function(Player, Order, Number)
	local NewOrder = Template:Clone()
	NewOrder.Parent = script.Parent.Container
	NewOrder.Name = Number
	NewOrder.Number.Text = NewOrder.Name
	NewOrder.Player.Text = Player.Name
	game.ReplicatedStorage.McOrderSystem.SendOrder2:Fire(Number,"create")
	
	for _, v in pairs(Order) do
		NewOrder.Content.Text = NewOrder.Content.Text.."\n"..tostring(v)
	end
		NewOrder.Claim.Visible = true
end)

Button that send the Remote Event that a player clicked the button.

script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.McOrderSystem.Important.lotofstuff:FireAllClients()
end)

Script that receive the event (if the staff claim the order)

local plr = game.Players.LocalPlayer
game.ReplicatedStorage.McOrderSystem.Important.lotofstuff.OnClientEvent:Connect(function()
	local order = workspace.OrderDisplay.Screen.Script:FindFirstChild("Order")

if order then
	
	game.ReplicatedStorage.McOrderSystem.Important.namegett:FireServer(plr)
	
	end
end)

Script that receive the Remote Event, and make the order claimed and completed!

McOrderingSystem.Important.namegett.OnServerEvent:Connect(function(plr)
	
	local OrderNumber = script.Parent.Parent.Name
	
	
	
	if script.Parent.check.Value == true then
		local order = script.Parent.Parent
		if order.Claimed.Visible == true then return end

		script.Parent.Text = "Complete"
		

		order.Claimed.Visible = true
		script.Parent.check.Value = false
		order.claimeduser.Text = "Claimed by: " .. plr.Name
		order.Claimed.UserWhoClaimed.Value = plr.Name
		
	elseif script.Parent.check.Value == false then
		local order = script.Parent.Parent
if order.Claimed.UserWhoClaimed.Value == plr.Name then
				local Customer = game.Players:FindFirstChild(order.Player.Text)
if Customer then
				else order:Destroy() McOrderingSystem.SendOrder2:Fire(OrderNumber,"delete") end
Customer.PlayerGui.OrderNumberDisplay.Enabled = false 
script.Parent.check.Value = true
				McOrderingSystem.Gui:FireClient(Customer)	McOrderingSystem.SendOrder2:Fire(OrderNumber,"complete")
			if order.Name == OrderNumber then
				order:Destroy()
			else
				print(script.Parent.Parent.Name .. " is nil")
			end 
		
	end
	end
end)

How it looks first time:
Non-claimed:

Claimed:

After the second order, how it looks:

And in the third order, the script doesn’t clone anymore the gui, so after the order (all blank) there are no clones.

Location of everything:

image
(The clone is Order, and after cloning the order, the order goes in container)
image
After 3 orders, the script doesn’t clone “Order”.

Location of Remote Events and local script that click the button.

image

1 Like

It’s long, anyway I appreciate your help! :smiley:

1 Like