I have an event that’s firing from the client when I press E button. Here is a part of this script:
UIS.InputBegan:Connect(function(input, gameProcessed)
for i,v in pairs(interactables) do
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.E and v.PrimaryPart.E.Enabled == true and (playerPosition - v.PrimaryPart.Position).magnitude <= 10 then
event:FireServer(v.PrimaryPart)
end
end
end
end)
And then there are multiple same scripts that activate when I press the button, but I want them to happen one at a time and not all at once. Part of the script:
local function toBread1()
if script.Disabled == false then
local player, item = event.OnServerEvent:Wait()
if item.Name == "Bun" then
local toTake = serverStorage.Items.Bun:Clone()
toTake.Parent = workspace
player.Character.Humanoid:EquipTool(toTake)
return
else
toBread1()
end
end
end
toBread1()