Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local UIS = game:GetService("UserInputService")
- local Players = game:GetService("Players").LocalPlayer
- local Character = Players.Character or Players.CharacterAdded:Wait()
- local Workspace = game:GetService("Workspace")
- local Quests = Workspace:WaitForChild("Quests")
- local RS = game:GetService("RunService")
- local Storage = game:GetService("ReplicatedStorage")
- local QuestModule = require(Storage:WaitForChild("Quests"))
- local Frame = script.Parent.Frame
- local Target;
- local CurrentNumber = 1 -- add 1 every time player clicks continue
- local MaxDescription;
- function updateDialogue(newDesc)
- print'boomer' -- these are the checks
- local getTarget = Quests:WaitForChild(Target)
- Frame.Description.Text = newDesc
- Frame.CharacterName.Text = tostring(QuestModule.getCharacterName(getTarget.QuestName.Value) )
- end
- Frame:WaitForChild("Continue").MouseButton1Click:Connect(function()
- if CurrentNumber == MaxDescription then
- print'Max description.'
- return
- end
- local getTarget = Quests:WaitForChild(Target)
- CurrentNumber = CurrentNumber + 1
- print(CurrentNumber)
- updateDialogue(QuestModule.getDialogue(getTarget.QuestName.Value)[CurrentNumber] )
- end)
- UIS.InputBegan:Connect(function(input, gpe)
- if gpe then return end
- if input.KeyCode == Enum.KeyCode.E then
- if Target == "" or Target == nil then print'nothing found yet' return end
- print(Target)
- local getTarget = Quests:WaitForChild(Target)
- if not getTarget then warn'fatal error could not get target' return end
- local Module = require(QuestModule.getModule(getTarget.QuestName.Value) )
- print'test again' -- these are the checks
- local Dialogue = QuestModule.getDialogue(getTarget.QuestName.Value)
- print'test againnn' -- these are the checks
- updateDialogue(Dialogue[CurrentNumber])
- print(CurrentNumber)
- if Frame.Open.Value == false then
- updateDialogue(Dialogue[CurrentNumber])
- Frame:TweenPosition(UDim2.new(0.286,0,0.215,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5, true)
- print'what?'
- Frame.Open.Value = true
- elseif Frame.Open.Value == true then
- Frame:TweenPosition(UDim2.new(0.286,0,-1,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5, true)
- Frame.Description.Text = ''
- Frame.CharacterName.Text = ''
- Frame.Open.Value = false
- CurrentNumber = 1
- end
- end
- end)
- RS.RenderStepped:Connect(function()
- for _,v in pairs(Quests:GetChildren()) do
- local Mag = (Character:WaitForChild('HumanoidRootPart').Position - v.HumanoidRootPart.Position).magnitude
- if Mag <= 7 then
- print'hi'
- Target = v.Name
- script.Parent:WaitForChild("TextButton"):TweenPosition(UDim2.new(0.387,0,0.908,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5, true)
- -- getting textbutton to tween (press E)
- break -- breaks the loop
- else
- Target = nil
- MaxDescription = nil
- Frame:TweenPosition(UDim2.new(0.286,0,-1,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5, true)
- Frame.Open.Value = false -- setting value so frame doesn't bug.
- script.Parent:WaitForChild("TextButton"):TweenPosition(UDim2.new(0.387,0,1.1,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5, true)
- CurrentNumber = 1
- Frame.Description.Text = ''
- Frame.CharacterName.Text = ''
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement