I'm trying to use Dialogue kit v2 and call a function to give me a badge when i press an option but it dosn't work.
Im also trying to do the same thing but kill the npc after clicking the option.
-- Function to award the badge
local function awardBadge(player)
local BadgeService = game:GetService("BadgeService")
if not BadgeService:UserHasBadgeAsync(player.UserId, badgeId) then
BadgeService:AwardBadge(player.UserId, badgeId)
end
end
local function die()
workspace.people.J.Humanoid.Health = 0
end ```
``` Layer7 = { -- This is the second layer.
DialogueContent = {"Wow, Thanks!"}, -- This is your next piece of content if the player selects Reply1
DialogueSounds = {},
DialogueImage = "rbxassetid://18611877176", -- You can change the image to display here.
LayerTitle = nil, -- You can change your Dialogue Title here. Keep as nil if you don't want it to change.
Replies = {
-- Replies are empty so you can add your own.
},
Exec = {
func1 = {
Function = awardBadge, -- Pass the function reference, not the call
ExecuteContent = "friend",
}
}```