Here is the full moudel script it soo weird
local sound = script:WaitForChild("استاذ فرقان صوت")
local Tweenservice = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(0.5,Enum.EasingStyle.Back,Enum.EasingDirection.In)
local continueBool = false
local tweeninfos = {
["ShowUpTween"] = TweenInfo.new(0.5,Enum.EasingStyle.Exponential,Enum.EasingDirection.Out),
["HideUpTween"] = TweenInfo.new(0.4,Enum.EasingStyle.Exponential,Enum.EasingDirection.In)
}
local WorkingTween = false
local module = {
CharacterSounds = 11,
SplitTextFunction = function(Text:string,voiceid,TextLabe:TextLabel)
local SplitText = Text:split("")
local ReText = ""
for _,Letter in ipairs(SplitText) do
if continueBool then
break
end
sound:Play()
ReText = ReText..Letter
TextLabe.Text = ReText
task.wait(0.07)
sound:stop()
end
end,
ShowHideUpQuest = function(Ui:ScreenGui,ShowOrHide:string)
if ShowOrHide == "show" and not WorkingTween then
local Frame:Frame = Ui:FindFirstChild("Frame")
if Frame then
local targetPositioin = Frame.Position
Frame.Position = targetPositioin + UDim2.new(0,0,1,0)
Ui.Enabled = true
local Tween = Tweenservice:Create(Frame,tweeninfos["ShowUpTween"],{Position = targetPositioin})
WorkingTween = true
Tween:Play()
Tween.Completed:Wait()
WorkingTween = false
print("updated workning tween to false")
end
elseif ShowOrHide == "hide" and not WorkingTween then
local Frame:Frame = Ui:FindFirstChild("Frame")
if Frame then
WorkingTween = true
local FrameOrignallPosition = Frame.Position
local targetPose = Frame.Position + UDim2.new(0,0,1,0)
local Tween = Tweenservice:Create(Frame,tweeninfos["ShowUpTween"],{Position = targetPose})
Tween.Completed:Wait()
Ui.Enabled = false
Frame.Position = FrameOrignallPosition
WorkingTween = false
end
else
print("error couldn't Know what is ,",ShowOrHide,"it might be cuz there is tween ",WorkingTween)
end
end,
Characters = {
["Fox"] = {
QuestTalkLines = {"Hello there would u like to help me please?","Well there is boxes over there can u bring them to me ?","Testoo:"},
FinshQuestLine = "Thank here a reward for u",
WaitingForQuestToFinsh = "soo are u bringing those boxes or not?",
Decline_Line = "Whatever u are too weak anyway to do it "
},
["Leeyo"] = {
QuestTalkLines = {"Ya dwag how u doin","i only want food 😭","HAHAHAHAH"},
FinshQuestLine = "Thank here a reward for u",
WaitingForQuestToFinsh = "soo are u bringing those boxes or not?",
Decline_Line = "u wont help i hopeless old man >:) "
},
["mxxitixx"] = {
QuestTalkLines = {"Sub my name is mobse","well can u talk to turkish for me?","so do we have a deal"},
FinshQuestLine = "Thank here a reward for u",
WaitingForQuestToFinsh = "are you going to talk to him?",
Decline_Line = "I guess i am going to talk to him "
},
}
}
function module:SetViewPortFrame(ViewportFrame:ViewportFrame,Character:Model)
print(ViewportFrame,Character)
for _,Thing in ViewportFrame:GetChildren() do
if Thing:IsA("Model") or Thing:IsA("Camera") then
Thing:Destroy()
end
end
local CharacterClone = Character:Clone()
CharacterClone:PivotTo(CFrame.new(0,0,0))
local newCamerea = Instance.new("Camera")
newCamerea.Parent = ViewportFrame
newCamerea.CFrame = CFrame.new(-0.151978925, 4.86038303, -2.51316714, -0.996948421, 0.0077367234, -0.0776794329, -0, 0.995076835, 0.0991077423, 0.0780637637, 0.0988053083, -0.992040157)
ViewportFrame.CurrentCamera = newCamerea
CharacterClone.Parent = ViewportFrame
end
function module:SetUpQuest(Ui:ScreenGui,Character,Player:Player)
local CharacterLines = self.Characters
local CharacterLine = CharacterLines[Character.Name]
local Frame:Frame = Ui:WaitForChild("Frame")
local NPCIMAGe = Frame:WaitForChild("NpcImage")
local NPCLINE = Frame:WaitForChild("NpcLine")
local continueBtn:TextButton = Frame:WaitForChild("continue")
local viewPortFrame:ViewportFrame = NPCIMAGe:WaitForChild("ViewportFrame")
self.ShowHideUpQuest(Ui,"show")
if Player:FindFirstChild("QUEST").Value == Character.Name.."Quest" then
if CharacterLine then
self.SplitTextFunction(CharacterLine["WaitingForQuestToFinsh"],nil,NPCLINE)
return
end
end
if CharacterLines then
self:SetViewPortFrame(viewPortFrame,Character)
continueBtn.MouseButton1Click:Connect(function()
if continueBtn.Text == "Accept" then
self.ShowHideUpQuest(Ui,"hide")
print("hide ui ")
end
continueBool = true
end)
for _,NormalLine in ipairs(CharacterLine.QuestTalkLines) do
if _ == #CharacterLine.QuestTalkLines then
continueBtn.Text = "Accept"
end
self.SplitTextFunction(NormalLine,nil,NPCLINE,continueBool)
while not continueBool do
task.wait()
end
continueBool = false
end
local Quest = Player:FindFirstChild("QUEST")
if Quest then
Quest.Value = Character.Name.."Quest"
end
return true
end
end
return module