#npc dialog bug weird

1 messages · Page 1 of 1 (latest)

slim oracleBOT
#

studio** You are now Level 1! **studio

rain imp
#

-- services
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--modules
local DialogModule = require(ReplicatedStorage.DialogModule)

--references
local player = game.Players.LocalPlayer
local npc = script.Parent -- Reference to the NPC model
local npcGui = npc:WaitForChild("Head"):WaitForChild("gui")
local prompt = npc:WaitForChild("ProximityPrompt")

local dialogObject = DialogModule.new("Billy", npc, prompt)
dialogObject:addDialog("Hello, how are you?", {"good","whats in the shop?","exit"})

--

-- what happens when triggered
prompt.Triggered:Connect(function(player)
dialogObject:triggerDialog(player, 1)
end)

-- logic to go through dialogs
dialogObject.responded:Connect(function(responseNum, dialogNum)
if dialogNum == 1 then
if responseNum == 1 then
dialogObject:hideGui("Great")
end
if responseNum == 2 then
dialogObject:hideGui("Take a look...")

        -- open shop
        local playerGui = player:WaitForChild("PlayerGui")
        local shopGui = playerGui:WaitForChild("ShopGui")
        local frame = shopGui.Frame
        frame.Position = UDim2.new(0.5, 0, 1.2, 0) -- start off screen

        shopGui.Enabled = true

        frame:TweenPosition(
            UDim2.new(0.5, 0, 0.5, 0),
            Enum.EasingDirection.Out,
            Enum.EasingStyle.Back,
            0.5,
            true
        )
    end
    if responseNum == 3 then
        dialogObject:hideGui("Rude!")
    end
end

end)

#

..

#

this is the script

#

i got it fixed dw