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

Dialog Follow Player?

Asked by
Xl5Xl5 65
8 years ago

How would I go about, When player chooses "Choice4" the NPC will follow the player thats selected the choice?

NPC >Head > Dialog > Script is here > Choice4

script.Parent.DialogChoiceSelected:connect(function(player,choice)

  local humanoid = player.Character:findFirstChild("Humanoid")

    if not humanoid then return end --End the function if the humanoid isn't found
local stats = player:FindFirstChild('leaderstats')
    if not stats then return end
local rep = stats:FindFirstChild('Reputation')
    if not rep then return end

    if choice.Name == "Choice1" then --If the DialogChoice's name is Die then do the following

        wait(1)
rep.Value = rep.Value - 1  
 player.Character:BreakJoints()     

    elseif choice.Name == "Choice2" then

        wait(1) 
rep.Value = rep.Value + 1

elseif choice.Name == "Choice3" then

        wait(1)
rep.Value = rep.Value - 2

    elseif choice.Name == "Choice4" then

        wait(1) 

    end

end)



Answer this question