I am trying to change the value of one of the children of the dialog which is a dialogchoice
(
reward.ResponseDialog = “No”
)
called reward instantly as the player selects the dialog but i dont know how , i am trying to do this where it says second part starts here
what happens with dialogchoiceselected: i talk once , it updates too slow
talk the second time , only this time i see the update
local ServerScriptService = game:FindFirstChild("ServerScriptService")
local remote = game.ReplicatedStorage:WaitForChild("PassInfo")
local player = game.Players.LocalPlayer
local remote2 = game.ReplicatedStorage:WaitForChild("Award")
-------------------------------------------------------------------------
local answer1 = workspace.Rig:WaitForChild("Head").Introduction.TaskQuestion.Task1.Answer
local task1 = workspace.Rig:WaitForChild("Head").Introduction.TaskQuestion.Task1
local question = workspace.Rig:WaitForChild("Head").Introduction.TaskQuestion
local dialog = workspace.Rig:WaitForChild("Head").Introduction
local reward = workspace.Rig:WaitForChild("Head").Introduction.Reward
-- 2 quest done
-- -1 quest just started
-- 0 quest step 1 done
dialog.DialogChoiceSelected:Connect(function(Player, Choice)
if Choice == question then
local Tracker = Player:FindFirstChild("leaderstat"):FindFirstChild("Quest1")
if Tracker.Value == -1 then
reward.Parent = dialog.Folder
answer1.Parent = task1
remote:FireServer(0)
task1.ResponseDialog = "Can you bring me a tomato?"
else if Tracker.Value == 0 then
reward.Parent = dialog.Folder
answer1.Parent = task1
remote:FireServer(1)
task1.ResponseDialog = "Did you bring the tomato yet?"
answer1.UserDialog = "No"
else if Tracker.Value == 1 then
reward.Parent = dialog.Folder
answer1.Parent = task1
remote:FireServer(2)
task1.ResponseDialog = "Did you bring the tomato yet?"
answer1.UserDialog = "Yes"
answer1.ResponseDialog = "Thanks!"
else if Tracker.Value == 2 then
reward.Parent = dialog
task1.ResponseDialog = "Not right now..."
answer1.Parent = dialog.Folder
end
end
end
end
end
end)
--SECOND PART HERE
dialog.InUse:GetPropertyChangedSignal("Value"):Connect(function(Player)
local Tracker = player:FindFirstChild("leaderstat"):FindFirstChild("Quest1")
if Tracker.Value == 2 then
reward.ResponseDialog = "Sure"
remote2:FireServer("Gun")
else if Tracker.Value ~= 2 then
reward.ResponseDialog = "No"
end
end
end)