You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Im building a sort of side quest to my game where you need to give 3 donuts to a wizard
that he will convert into a “Poisoned Donut”
However, I need to find a way to see if they do have the 3 donuts
and If they only bring 1, he says
"I still need you to bring (donut) and (donut)
and if they bring 2
"I still need you to bring the (donut)
i dont whats wrong with the script, but even when i have 2 of the needed donuts in my inv,
it only fires once ( i only lose 1 donut)
if talkedtowizard == true then
if npc.Name == "Wizard" then
local RequiredDonuts = {
game.ReplicatedStorage.Tools:WaitForChild('Donuts'):WaitForChild('Chocolate Donut').Name,
game.ReplicatedStorage.Tools:WaitForChild('Donuts'):WaitForChild('OrangeCherry Donut').Name,
game.ReplicatedStorage.Tools:WaitForChild('Donuts'):WaitForChild('WaterMelon Donut').Name
}
for i, donut in ipairs(RequiredDonuts) do
if plr.Character:FindFirstChild(donut) or plr.Backpack:FindFirstChild(donut) then
print('brought ' .. donut)
game.ReplicatedStorage.remotes.deletedonut:FireServer(donut)
table.remove(RequiredDonuts, table.find(RequiredDonuts, donut))
end
end
print(RequiredDonuts)
if #RequiredDonuts == 0 then
TextLines = {
'thank you',
}
else
if #RequiredDonuts == 1 then
TextLines = {
"Thank you,",
"but I still need a " .. RequiredDonuts[1],
'Come back when you have it.'
}
elseif #RequiredDonuts == 2 then
TextLines = {
"Thank you, but you still need to bring:",
" a " .. RequiredDonuts[1],
" a " .. RequiredDonuts[2],
}
end
end
end
end