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

Dialogue only appear when quest is in progress?

Asked by 6 years ago

I made a quest system and a dialogue gui but can't figure out a way to make a dialogue gui appear once a player has completed a quest. I've asked this before and received a answer which could work. Someone said to change the variables to true/false indicating the quest. But I'm not sure how this would exactly work since I'd have to change up the quest system. If anyone can please tell me a different way to only make the dialogue show when a quest has been completed please tell me.

Quest Completion Marker(for reference of how the mission becomes assigned complete):

script.Parent.Touched:connect(function(touchedpart)
local player = game.Players:GetPlayerFromCharacter(touchedpart.Parent)

if player then
if player:FindFirstChild("Quest6") and player:FindFirstChild("Quest6").Value == "-[Get a Water Tank]" then
player.Quest6.Value = "-[Completed]"
game.Workspace.Data[player.Name].Socks.Value = game.Workspace.Data[player.Name].Socks.Value + 1

        end

    end

 end)

Dialogue System:

local debounce = false

function getPlayer(humanoid) 
local players = game.Players:children() 
for i = 1, #players do 
if players[i].Character.Humanoid == humanoid then return players[i] end 
end 
return nil 
end 

function onTouch(part) 

local human = part.Parent:findFirstChild("Humanoid") 
if (human ~= nil) and debounce == false then

debounce = true

local player = getPlayer(human) 

if (player == nil) then return end 

script.Parent:clone().Parent = player.PlayerGui
wait(17)
debounce = false
player.PlayerGui.OnTouchGui:remove()
wait()
debounce = false
wait(17)
end
end


script.Parent.Parent.Touched:connect(onTouch) 

Answer this question