Hello Guys, this script: it works well, but when we want it to sound different if we do not have the item, (the sound and the notification prompt do not appear)
How can I activate different sound effects for a single button when the event is not activated? Thank you.
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.ItemsEvents.SellAxEvent:FireServer()
script.Parent.Sound:Play()
wait(0.1)
local starterGui = game:GetService("StarterGui")
-- Function to create a notification with title and text
local function createNotification(title, text)
starterGui:SetCore("SendNotification", {
Title = "🥰NICE🥰",
Text = "You did it!!",
Duration = 3 -- Adjust the duration as needed (in seconds)
})
end
-- Call the createNotification function to display a message
createNotification("Done")
end)
-- script.Parent.Duck:Play() when the event doesn´t activates
--[[wait(0.1)
local starterGui = game:GetService("StarterGui")
-- Function to create a notification with title and text
local function createNotification(title, text)
starterGui:SetCore("SendNotification", {
Title = "Wrong",
Text = "you don´t have it!!",
Duration = 3 -- Adjust the duration as needed (in seconds)
})
end
-- Call the createNotification function to display a message
createNotification("dont work")
end
end)