I created a dialog, and I want to check if a value is true for example.
So if a value is true the NPC response is “Yes” and vice versa for false.
Seems to me that the script fires not after I clicked the choice but after the Dialog already responded.
-- Client
Dialog.DialogChoiceSelected:Connect(function(Player, Choice)
if Choice == Dialog.Pay then
Events.Test:FireServer()
end
end)
-- Server
Events.Test.OnServerEvent:Connect(function(Player)
--local Dollars = Player:FindFirstChild("Dollars")
--if not Dollars then return end
Dialog.Pay.ResponseDialog = "Ok!"
end)
And the Response on the DialogChoice itself is something else, when I click the response it first responds with the original, then the next time I do the dialog it’s the new response that I created from the script.
You’re on the right track.
Or course, the problem is that you’re setting the response in the server script, and the dialog is on the client. The dialog is client-side, meaning it belongs to the local player.
So, when you set the response in the server script, the local player has no knowledge of that change until it’s communicated back to the client.
To fix this, you need to communicate the change back to the client.
You can do this in a number of ways. The simplest way is to just fire an event that has the new response attached to it, and then your client can wait for the event and then set the dialog response accordingly.