Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local localPlayer = game.Players.LocalPlayer
- local parent = script.Parent
- local storage = game:GetService('ReplicatedStorage')
- local remote = storage.Remotes.Dialogue
- local tollremote = storage.Remotes.PayToll
- local eventremote = storage.Remotes.EventTrigger
- local marketremote = storage:WaitForChild('Remotes'):WaitForChild('BlackMarket')
- local m = require(storage.Resources.Dialogue)
- local deb = false
- local deb2 = false
- local inchat = false
- local playerHolder = parent.PT
- local npcHolder = parent.NPCT
- local sample = script.Sample
- --local InEvent = localPlayer:WaitForChild('Bools'):WaitForChild('InEvent')
- local function animate(phrase)
- local text = phrase
- for i = 1, #text do
- npcHolder.RES.Text = string.sub(text, 1, i)
- wait(.1)
- end
- end
- local function clearChat()
- for i,v in pairs(playerHolder:GetChildren())do
- if v:IsA('ImageLabel')then
- v:Destroy()
- end
- end
- npcHolder.RES.Text = " "
- end
- local function ELOOP(event)
- parent.Visible = true
- local FIRE = m.dialogue[event]
- animate(FIRE['Dialog1']['NPCRES']['INITIAL'])
- wait(2)
- for i,v in pairs(FIRE['Dialog1']['PRES'])do
- local clone = sample:Clone()
- clone.Name = i
- clone.RES.Text = v
- clone.Parent = playerHolder
- clone.RES.MouseButton1Click:Connect(function()
- if deb2 then return end
- deb2 = true
- clearChat()
- animate(FIRE['Dialog1']['NPCRES'][clone.Name])
- wait(2)
- if FIRE['Dialog2'] and not clone.Name == 'EXIT'then
- print('MORE')
- deb2 = false
- else
- clearChat()
- parent.Visible = false
- inchat = false
- deb2 = false
- end
- end)
- end
- end
- local function EEVENT(event)
- parent.Visible = true
- local FIRE = m.dialogue[event]
- local InEvent = localPlayer:FindFirstChild('Bools'):FindFirstChild('InEvent')
- local completed = localPlayer:FindFirstChild('Bools'):FindFirstChild('IsComplete')
- if InEvent.Value == true then
- eventremote:FireServer('CHECK', m.dialogue[event]['EVENT'])
- wait(1)
- print(completed.Value)
- if completed.Value == true then
- print('CHECK TRUE IS COMPLETE')
- animate(m.dialogue[event]['COMPLETE']['NPCRES']['INITIAL'])
- wait(2)
- for i,v in pairs(m.dialogue[event]['COMPLETE']['PRES'])do
- local clone = sample:Clone()
- clone.Name = i
- clone.RES.Text = v
- clone.Parent = playerHolder
- clone.RES.MouseButton1Click:Connect(function()
- if deb2 then return end
- deb2 = true
- if clone.Name == 'EXIT'then
- clearChat()
- parent.Visible = false
- inchat = false
- deb2 = false
- end
- end)
- end
- else
- print('CHECK FALSE NOT COMPLETE')
- animate(m.dialogue[event]['ACTIVE']['NPCRES']['INITIAL'])
- wait(2)
- for i,v in pairs(m.dialogue[event]['ACTIVE']['PRES'])do
- local clone = sample:Clone()
- clone.Name = i
- clone.RES.Text = v
- clone.Parent = playerHolder
- clone.RES.MouseButton1Click:Connect(function()
- if deb2 then return end
- deb2 = true
- if clone.Name == 'EXIT'then
- clearChat()
- parent.Visible = false
- inchat = false
- deb2 = false
- end
- end)
- end
- end
- else
- animate(m.dialogue[event]['Dialog1']['NPCRES']['INITIAL'])
- wait(2)
- for i,v in pairs(m.dialogue[event]['Dialog1']['PRES'])do
- local clone = sample:Clone()
- clone.Name = i
- clone.RES.Text = v
- clone.Parent = playerHolder
- clone.RES.MouseButton1Click:Connect(function()
- if deb2 then return end
- deb2 = true
- if clone.Name == 'EXIT'then
- clearChat()
- animate(m.dialogue[event]['Dialog1']['NPCRES']['EXIT'])
- wait(2)
- parent.Visible = false
- inchat = false
- deb2 = false
- elseif clone.Name == 'RES1' then
- clearChat()
- animate(m.dialogue[event]['Dialog1']['NPCRES']['RES1'])
- wait(2)
- eventremote:FireServer('REGISTER', m.dialogue[event]['EVENT'])
- clearChat()
- parent.Visible = false
- inchat = false
- deb2 = false
- end
- end)
- end
- end
- end
- local function ESMALL(event)
- parent.Visible = true
- local FIRE = m.dialogue[event]
- animate(FIRE['NPCRES']['INITIAL'])
- wait(2)
- clearChat()
- parent.Visible = false
- inchat = false
- end
- local function ETELEPORT(event, city)
- parent.Visible = true
- local FIRE = m.dialogue[event]
- animate(FIRE['NPCRES']['INITIAL'])
- wait(2)
- for i,v in pairs(FIRE['PRES'])do
- local clone = sample:Clone()
- clone.Name = i
- clone.RES.Text = v
- clone.Parent = playerHolder
- clone.RES.MouseButton1Click:Connect(function()
- if deb2 then return end
- deb2 = true
- clearChat()
- animate(FIRE['NPCRES'][clone.Name])
- wait(2)
- if clone.Name == 'EXIT'then
- deb2 = false
- clearChat()
- parent.Visible = false
- inchat = false
- else
- deb2 = false
- clearChat()
- parent.Visible = false
- inchat = false
- tollremote:FireServer(city)
- end
- end)
- end
- end
- local function ESTORE(event)
- parent.Visible = true
- local FIRE = m.dialogue[event]
- animate(FIRE['Dialog1']['NPCRES']['INITIAL'])
- wait(2)
- for i,v in pairs(FIRE['Dialog1']['PRES'])do
- local clone = sample:Clone()
- clone.Name = i
- clone.RES.Text = v
- clone.Parent = playerHolder
- clone.RES.MouseButton1Click:Connect(function()
- if deb2 then return end
- deb2 = true
- clearChat()
- animate(FIRE['Dialog1']['NPCRES'][clone.Name])
- wait(2)
- if clone.Name == 'EXIT' then
- deb2 = false
- clearChat()
- parent.Visible = false
- inchat = false
- else
- deb2 = false
- clearChat()
- parent.Visible = false
- inchat = false
- marketremote:FireServer('OPEN')
- end
- end)
- end
- end
- remote.OnClientEvent:Connect(function(event, city)
- if deb then return end
- deb = true
- if inchat then wait(1) deb = false return end
- inchat = true
- deb = false
- local FIRE = m.dialogue[event]['TYPE']
- if FIRE == 'LOOP' then
- ELOOP(event)
- elseif
- FIRE == "EVENT" then
- EEVENT(event)
- elseif
- FIRE == "SMALL" then
- ESMALL(event)
- elseif
- FIRE == "TELEPORT" then
- ETELEPORT(event, city)
- elseif
- FIRE == 'STORE' then
- ESTORE(event)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement