It's a bit complicated to me, this is what I tried:
function onClick() wait(1) local enabled = true function touchedEffect() if not enabled then return end if not touchedEffect then return end local character = touchedEffect.Parent local player = game.Players:GetPlayerFromCharacter(character) player.leaderstats.Candy.Value = player.leaderstats.Candy.Value +3 end end if script.Parent.InUse then (onClick) end
script.Parent.DialogChoiceSelected:connect(function(player, choice) if choice == "I want candy!" then --Just an example of the dialog choice they could have made player.leaderstats.Candy.Value = player.leaderstats.Candy.Value + 3 end end)
Not quite sure what the touchedEffect was meant for so I don't know what to put there instead.
The DialogChoiceSelected is fired whenever a choice is selected. Let's say they pick the option "I want candy!", it will then check if they picked that and then raise the value of candy by three. If this isn't what you wanted, please elaborate.
NOTE: I am at school and the documentation isn't completely filled out for that event so I am not 100% sure this will work, if it doesn't then when I get home I will update this.