Advertisement
MandB

StoryGameHandler

Dec 17th, 2021
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. --Type Gui Script
  2.  
  3. local function AnimateText(Text)
  4.     for i = 1, #Text, 1 do
  5.         script.Parent.TextLabel.Text = string.sub(Text,1,i)
  6.         wait(0.03)
  7.     end
  8. end
  9.  
  10. while true do
  11.     AnimateText("👋 Welcome To The Game!")--Text Here
  12.     wait(4)
  13.     AnimateText("💰 Use The Shop To Buy Tools")--Text Here
  14.     wait(4)
  15.     AnimateText("👍 Make Sure To Like The Game")--Text Here
  16.     wait(4)
  17. end
  18.  
  19. --PurchaseScript
  20.  
  21. local MarketplaceService = game:GetService("MarketplaceService")
  22. local Player = game.Players.LocalPlayer
  23.  
  24. for i,Button in pairs(script.Parent:GetChildren()) do
  25.     if Button:IsA("ImageButton") or Button:IsA("TextButton") then
  26.        
  27.         Button.MouseButton1Click:Connect(function()
  28.             local GamepassId = Button:FindFirstChild("GamepassId")
  29.            
  30.             MarketplaceService:PromptGamePassPurchase(Player, GamepassId.Value)
  31.         end)
  32.        
  33.     end
  34. end
  35.  
  36. --ExitScript
  37.  
  38. local ExitEvent = game.ReplicatedStorage.ExitEvent
  39. local Player = game.Players.LocalPlayer
  40.  
  41. ExitEvent.OnClientEvent:Connect(function()
  42.     Player.PlayerGui:WaitForChild("ExitGui").ExitButton.Visible = true
  43. end)
  44.  
  45. Player.PlayerGui:WaitForChild("ExitGui").ExitButton.MouseButton1Click:Connect(function()
  46.     ExitEvent:FireServer()
  47.     Player.PlayerGui:WaitForChild("ExitGui").ExitButton.Visible = false
  48. end)
  49.  
  50. --TransitionScript
  51.  
  52. local TweenService = game:GetService("TweenService")
  53. local TransitionEvent = game.ReplicatedStorage.TransitionEvent
  54.  
  55. local Player = game.Players.LocalPlayer
  56. local TransitionGui = Player.PlayerGui:WaitForChild("TransitionGui")
  57. local Frame = TransitionGui:WaitForChild("Frame")
  58.  
  59. TransitionEvent.OnClientEvent:Connect(function()
  60.     local FrameVisible = {}
  61.     FrameVisible.BackgroundTransparency = 0
  62.    
  63.     local Info = TweenInfo.new(1)
  64.    
  65.     TweenService:Create(Frame, Info, FrameVisible):Play()
  66. end)
  67.  
  68.  
  69. --serverscriptservice
  70.  
  71. local MarketplaceService = game:GetService("MarketplaceService")
  72. local GamepassTools = game.ReplicatedStorage:FindFirstChild("GampassTools")
  73.  
  74. local function GiveTool(Player,Id,Tool)
  75.     if MarketplaceService:UserOwnsGamePassAsync(Player.UserId,Id) then
  76.         Tool:Clone().Parent = Player.Backpack
  77.         Tool:Clone().Parent = Player.StarterGear
  78.     end
  79. end
  80.  
  81. game.Players.PlayerAdded:Connect(function(Player)
  82.     GiveTool(Player,22972347,GamepassTools.Flashlight)
  83.    
  84.     GiveTool(Player,22972502,GamepassTools.Medkit)
  85.    
  86.     GiveTool(Player,22972549,GamepassTools.SpeedCoil)
  87. end)
  88.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement