Hi! This script is supposed to give a player 3 items, but I get the error “Vanilla Cakepop is not a valid member of Folder”. Item1, Item2, and Item3 all return “Vanilla Cakepop”. FinishedItems is a folder in ServerStorage. There is a tool in FinishedItems called Vanilla Cakepop, so idk why it is giving me this error. Here is the script:
game.ReplicatedStorage.GivePlayerOrder3.OnServerEvent:Connect(function(Chef, Item1, Item2, Item3, Customer)
local finishedFolder = game.ServerStorage:FindFirstChild("FinishedItems")
if game.Players:FindFirstChild(Customer) then
local clone1 = finishedFolder[tostring(Item1)]:Clone()
clone1.Parent = game.Players[Customer].Backpack
local clone2 = finishedFolder[tostring(Item2)]:Clone()
clone2.Parent = game.Players[Customer].Backpack
local clone3 = finishedFolder[tostring(Item2)]:Clone()
clone3.Parent = game.Players[Customer].Backpack
print("3 items given to customer: " .. Customer)
else
print("Unfortunately, player left.")
end
end)
Can you show a picture of your explorer? It might not replicate right away, or it might not have that exact name, but it’s hard to tell without more context.
script.Parent.MouseButton1Click:Connect(function()
local amountSplit = string.split(script.Parent.Parent.AmountOfItemsCorrect.Text, "/")
if amountSplit[1] == amountSplit[2] then
local orderSplit = string.split(script.Parent.Parent.Order.Text, ", ")
local CustomerSplit = string.split(script.Parent.Parent.Customer.Text, "ustomer: ")
local Customer = tostring(CustomerSplit[2])
if #orderSplit == 3 then
game.ReplicatedStorage.GivePlayerOrder3:FireServer(tostring(orderSplit[1]), tostring(orderSplit[2]), tostring(orderSplit[3]), Customer) --this line of code fires the event
end
if #orderSplit == 2 then
game.ReplicatedStorage.GivePlayerOrder2:FireServer(tostring(orderSplit[1]), tostring(orderSplit[2]), Customer)
end
if #orderSplit == 1 then
game.ReplicatedStorage.GivePlayerOrder1:FireServer(tostring(orderSplit[1]), Customer)
end
else
print("Not all items made!")
end
end)
It means I deleted my comment - I replied telling you that serverstorage can’t be used in a localscript but then I realized you had said it was a normal script.