Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a dialog choice take currency to switch teams?

Asked by 5 years ago
workspace.Dialog.DialogChoiceSelected:connect(function(player,choice)
    if choice.Name == "I'll take the job!" then
        player.Character.Team = "Factory"
    elseif choice.Name == "Maybe some other time" then
    end
end)

I want to try and add a line to pay 1000 Money to change teams to Factory but im having issues setting up the script. was wondering if anyone could give me a hand real quick if its not too much trouble

1 answer

Log in to vote
0
Answered by 5 years ago
workspace.Dialog.DialogChoiceSelected:connect(function(player,choice)
    if choice.Name == "I'll take the job!" then
    if player.Coins >= 1000 then -- change player.Coins to wherever your coins are stored
            player.Coins = player.Coins - 1000 -- change player.Coins to wherever your coins are stored
        player.Character.Team = "Factory"
    else
        -- What happens when the player doesn't have the cash but tries to join anyways?
    end
    elseif choice.Name == "Maybe some other time" then
    end
end)

This would make it work, I'd add new dialog options if the player doesn't have the cash.

Ad

Answer this question