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

Dialog Choice Reward. How do you do this?

Hey, so I was wondering about how to make an event that gives a player Money If they choose the DialogChoice

Picture 1: https://gyazo.com/fcd7cb4056ede827446a93f1783e5091

script.Parent.Parent.Dialog.DialogChoiceSelected:Connect(function(player,choice)
	if choice.Name == "MoneyGiver" then
		
		local PlayerMoney = player.leaderstats.Money
		PlayerMoney.Value = PlayerMoney.Value + 1
	end
end)

2 answers

I think your issue is the fact that the DialogChoiceSelected only works on the client side, so the event should be handled in a local script. For the money increasing part, due to the fact that changes made on the client arent replicated to the server, you'll have to use a remote event, and have a script that fires when the event is fired, increasing the money value within the player.

P.S. Use the player added event to access the player in the server script, and in the local, use the localplayer

Sorry I couldn't provide any code, I'm on mobile

So I'm really not sure anymore but I tried rewriting it by googling a bit but it seems to not be working.

local dialog = script.Parent.Parent.Dialog
dialog.DialogChoiceSelected:Connect(function(player,select)
	
	if select.Name == "Money Giver"
	then
		
		-- Changing the value of the the players Money by "100"
		local PlayerMoney = player.leaderstats.Money
		PlayerMoney.Value = PlayerMoney.Value + 100
		-- Changing the value of the the players Money by "100"
		
	end
	
end)

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