Full Module Script:
local dialogue = {}
local isdonefunction = game:GetService("ReplicatedStorage"):FindFirstChild("gamelogic").isdonefunction;
local randomnames = {
"James",
"aftonskyy",
"Scott",
"Fgott",
"Nvishurl",
"Peter Parker",
"Dr.Octupus",
"Jeb",
"William",
"Notch",
"Opium",
"destroy lonely",
}
local vkusi = {
"Chocolate flavor",
"Pistachio flavor",
"Vanilla flavor",
"Banana flavor",
}
local randomvkusvalue = game:GetService("ReplicatedStorage"):FindFirstChild("gamelogic").randomvkus;
randomvkusvalue.Value = vkusi[math.random(1,#vkusi)];
task.wait(1);
dialogue.hellotexts = {
[1] = {
dialoguetext = "Hello, i want to buy "..randomvkusvalue.Value.." ice cream";
choices = {
[1] = {
choice = "No";
dialoguetext = "I will write a bad review!";
};
[2] = {
choice = "Okay";
dialoguetext = "I'm waiting";
};
};
},
[2] = {
dialoguetext = "HELLO FAST MAKE ME "..randomvkusvalue.Value.." ICE CREAM";
choices = {
[1] = {
choice = "DO NOT SHOUT AT ME";
dialoguetext = "HATE YOU";
};
[2] = {
choice = "Okay";
dialoguetext = "FASTER";
};
};
},
}
dialogue.correntends = {
[1] = {
dialoguetext = "Thank you!";
},
[2] = {
dialoguetext = "YEAAHH";
},
[3] = {
dialoguetext = "THIS IS SO DELICIOUS!";
},
[4] = {
dialoguetext = "Omg Thanks!";
},
[5] = {
dialoguetext = "Subscribe to afton5057 YouTube channel";
},
}
dialogue.uncorrentends = {
[1] = {
dialoguetext = "hate you";
},
[2] = {
dialoguetext = "I will write a bad review";
},
[3] = {
dialoguetext = "This is not what I wanted!";
},
[4] = {
dialoguetext = "NO! THIS IS NOT WHAT I WANTED";
},
[5] = {
dialoguetext = "bro really thought i ordered this💀";
},
}
local canhide = false;
function dialogue.typewrite(text,label)
canhide = false;
label.Text = "";
for i = 1,#text,1 do
label.Text = string.sub(text,1,i);
task.wait(0.05);
end
task.wait(1);
canhide = true;
end
function dialogue.appear(gui)
game.TweenService:Create(gui,TweenInfo.new(.2),{Position = UDim2.new(0.218, 0,0.533, 0)}):Play();
end
function dialogue.close(gui)
game.TweenService:Create(gui,TweenInfo.new(.2),{Position = UDim2.new(0.218, 0,2, 0)}):Play();
end
function dialogue.openicecreamtypes(gui,textlabel,dialoguegui)
dialogue.appear(gui.Types);
local one = gui.Types.one;
local two = gui.Types.two;
local three = gui.Types.three;
local four = gui.Types.four;
local buttons = {
[gui.Types.one] = "Chocolate flavor",
[gui.Types.two] = "Pistachio flavor",
[gui.Types.three] = "Vanilla flavor",
[gui.Types.four] = "Banana flavor",
}
local selectedButton = nil;
for buttonType, vkus in pairs(buttons) do
if vkus == randomvkusvalue.Value then
selectedButton = buttonType;
break;
end
end
if selectedButton ~= nil then
print(selectedButton);
for i, buttons in pairs(gui.Types:GetChildren()) do
if buttons:IsA("TextButton") then
buttons.MouseButton1Click:Connect(function()
if buttons.Name == selectedButton.Name then
dialogue.close(gui.Types);
dialogue.appear(dialoguegui.container);
local randomends = dialogue.correntends[math.random(1,#dialogue.correntends)];
dialogue.typewrite(randomends.dialoguetext,textlabel);
if canhide then
dialogue.close(dialoguegui.container);
isdonefunction:InvokeServer();
end
else
dialogue.close(gui.Types);
dialogue.appear(dialoguegui.container);
local randomends = dialogue.uncorrentends[math.random(1,#dialogue.uncorrentends)];
dialogue.typewrite(randomends.dialoguetext,textlabel);
if canhide then
dialogue.close(dialoguegui.container);
isdonefunction:InvokeServer();
end
end
end)
end
end
selectedButton.MouseButton1Click:Connect(function()
end)
else
end
end
function dialogue.opendialogueandtext(plrname,dialoguegui,icecreamtypesgui)
randomvkusvalue.Value = vkusi[math.random(1,#vkusi)];
task.wait(1);
dialogue.appear(dialoguegui.container);
local choiceone = dialoguegui.container.Choiceone;
local choicetwo = dialoguegui.container.Choicetwo;
local TextLabel = dialoguegui.container.dialogueframe.TextLabel;
local nametext = dialoguegui.container.Nametext;
nametext.Text = randomnames[math.random(1,#randomnames)];
local randomdialogue = nil;
randomdialogue = dialogue.hellotexts[math.random(1,#dialogue.hellotexts)];
dialogue.typewrite(randomdialogue.dialoguetext,TextLabel);
if randomdialogue.choices then
choiceone.Visible = true;
choicetwo.Visible = true;
choiceone.Text = randomdialogue.choices[1].choice;
choicetwo.Text = randomdialogue.choices[2].choice;
choiceone.MouseButton1Click:Connect(function()
choiceone.Visible = false;
choicetwo.Visible = false;
dialogue.typewrite(randomdialogue.choices[1].dialoguetext,TextLabel);
if canhide then
dialogue.close(dialoguegui.container);
isdonefunction:InvokeServer();
end
end)
choicetwo.MouseButton1Click:Connect(function()
choiceone.Visible = false;
choicetwo.Visible = false;
dialogue.typewrite(randomdialogue.choices[2].dialoguetext,TextLabel);
if canhide then
dialogue.close(dialoguegui.container);
dialogue.openicecreamtypes(icecreamtypesgui,TextLabel,dialoguegui);
end
end)
else
choiceone.Visible = false;
choicetwo.Visible = false;
if canhide then
dialogue.close(dialoguegui.container);
randomdialogue = nil;
end
end
end
return dialogue;