Clickable toaster for simulator game not working

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

  1. What do you want to achieve? To make a clickable, working toaster that gives coins based on ur toast and idk

  2. What is the issue?
    The scripts won’t do anything
    image

local player = game.Players.LocalPlayer
local items = {}
local db = false

script.Parent.Clicked.OnClientEvent:Connect(function()
	if db == false then
		db = true
		script.Parent.Toasting:Play()
		for _, v in pairs(player.Backpack:GetChildren()) do
			if v:IsA("Tool") then
				table.insert(items, v.Name)
			end
		end
		local result = script.Parent.Toast:InvokeServer(items)
		repeat wait() until result == true
		script.Parent.Ding:Play()
		table.clear(items)
		db = false
	end
end)
script.Parent.ClickDetector.MouseClick:Connect(function(player)
	script.Parent:WaitForChild("Clicked"):FireClient(player)
end)

script.Parent.Toast.OnServerInvoke = function(player, items)
	if player:FindFirstChild("ToastingTime") then
		local primaryItem = game.ReplicatedStorage.Items:WaitForChild(items[1])
		for _, v in pairs(items) do
			if player.Backpack:FindFirstChild(v.Name) then
				player.Backpack:WaitForChild(v.Name):Destroy()
			end
		end
		wait(player:WaitForChild("ToastingTime").Value)
		for _, v in pairs(items) do
			if game.ReplicatedStorage:WaitForChild("Items"):FindFirstChild(v.Name) then
				game.ReplicatedStorage:WaitForChild("Items"):WaitForChild(v.Name):Clone().Parent = player.Backpack
			end
		end
		if player:FindFirstChild("Coins") then
			if player:FindFirstChild("Prestiges") then
				if player:WaitForChild("Prestiges").Value == 0 then
					player:WaitForChild("Coins").Value += primaryItem.Worth.Value
				elseif player:WaitForChild("Prestiges").Value >= 1 then
					player:WaitForChild("Coins").Value += primaryItem.Worth.Value * (player:WaitForChild("Prestiges").Value + 1)
				end
			end
		end
		return true
	end
end

Can we see how things are arranged?

Like wdym?

20chars20chars

I mean can we see how things are arranged in the explorer. Sorry about that.

Alright my friend made most of the building stuff, don’t judge on his spelling- he has a thing where he’s bad at spelling

image

image

image

image

Instead of dumping all over your scripts here you should try and isolate the issue by adding print commands to see where the scripts are no longer functioning as intended, that way you can provide us (who don’t have access/knowledge of your game’s mechanics) the exact lines/areas in code where the scripts are having issues.