Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.