Advertisement
Aquarius_Raverus

Script

Jun 5th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.33 KB | None | 0 0
  1. local UIS = game:GetService("UserInputService")
  2. local Players = game:GetService("Players").LocalPlayer
  3. local Character = Players.Character or Players.CharacterAdded:Wait()
  4.  
  5. local Workspace = game:GetService("Workspace")
  6. local Quests = Workspace:WaitForChild("Quests")
  7.  
  8. local RS = game:GetService("RunService")
  9. local Storage = game:GetService("ReplicatedStorage")
  10.  
  11. local QuestModule = require(Storage:WaitForChild("Quests"))
  12.  
  13. local Frame = script.Parent.Frame
  14.  
  15. local Target;
  16. local CurrentNumber = 1 -- add 1 every time player clicks continue
  17. local MaxDescription;
  18.  
  19. function updateDialogue(newDesc)
  20.     print'boomer' -- these are the checks
  21.     local getTarget = Quests:WaitForChild(Target)
  22.    
  23.     Frame.Description.Text = newDesc
  24.     Frame.CharacterName.Text = tostring(QuestModule.getCharacterName(getTarget.QuestName.Value) )
  25. end
  26.  
  27. Frame:WaitForChild("Continue").MouseButton1Click:Connect(function()
  28.     if CurrentNumber == MaxDescription then
  29.         print'Max description.'
  30.        
  31.         return
  32.     end
  33.        
  34.     local getTarget = Quests:WaitForChild(Target)
  35.    
  36.     CurrentNumber = CurrentNumber + 1
  37.     print(CurrentNumber)
  38.     updateDialogue(QuestModule.getDialogue(getTarget.QuestName.Value)[CurrentNumber] )
  39. end)
  40.  
  41. UIS.InputBegan:Connect(function(input, gpe)
  42.     if gpe then return end
  43.    
  44.     if input.KeyCode == Enum.KeyCode.E then
  45.         if Target == "" or Target == nil then print'nothing found yet' return end
  46.        
  47.         print(Target)
  48.        
  49.         local getTarget = Quests:WaitForChild(Target)
  50.         if not getTarget then warn'fatal error could not get target' return end
  51.        
  52.         local Module = require(QuestModule.getModule(getTarget.QuestName.Value) )
  53.         print'test again' -- these are the checks
  54.         local Dialogue = QuestModule.getDialogue(getTarget.QuestName.Value)
  55.         print'test againnn' -- these are the checks
  56.        
  57.         updateDialogue(Dialogue[CurrentNumber])
  58.        
  59.         print(CurrentNumber)
  60.                
  61.        
  62.         if Frame.Open.Value == false then
  63.             updateDialogue(Dialogue[CurrentNumber])
  64.            
  65.        
  66.             Frame:TweenPosition(UDim2.new(0.286,0,0.215,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5, true)
  67.             print'what?'
  68.             Frame.Open.Value = true
  69.         elseif Frame.Open.Value == true then
  70.            
  71.             Frame:TweenPosition(UDim2.new(0.286,0,-1,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5, true)
  72.             Frame.Description.Text = ''
  73.             Frame.CharacterName.Text = ''
  74.            
  75.             Frame.Open.Value = false
  76.             CurrentNumber = 1
  77.         end
  78.     end
  79.    
  80. end)
  81.  
  82. RS.RenderStepped:Connect(function()
  83.     for _,v in pairs(Quests:GetChildren()) do
  84.         local Mag = (Character:WaitForChild('HumanoidRootPart').Position - v.HumanoidRootPart.Position).magnitude
  85.                
  86.         if Mag <= 7 then
  87.             print'hi'
  88.            
  89.             Target = v.Name
  90.            
  91.             script.Parent:WaitForChild("TextButton"):TweenPosition(UDim2.new(0.387,0,0.908,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5, true)
  92.             -- getting textbutton to tween (press E)
  93.            
  94.             break -- breaks the loop
  95.         else
  96.             Target = nil
  97.             MaxDescription = nil
  98.                        
  99.             Frame:TweenPosition(UDim2.new(0.286,0,-1,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5, true)
  100.             Frame.Open.Value = false -- setting value so frame doesn't bug.
  101.            
  102.             script.Parent:WaitForChild("TextButton"):TweenPosition(UDim2.new(0.387,0,1.1,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5, true)
  103.             CurrentNumber = 1
  104.            
  105.             Frame.Description.Text = ''
  106.             Frame.CharacterName.Text = ''
  107.         end
  108.     end
  109.    
  110. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement