You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? To make a clickable, working toaster that gives coins based on ur toast and idk
-
What is the issue?
The scripts won’t do anything
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