Advertisement
qsenko1

Unfinished Legit Trails,Multi Gamepass Touchpads!!!

Jul 6th, 2021
1,112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.50 KB | None | 0 0
  1. local trails = script.Parent:GetDescendants()
  2. local debounce = true
  3. --print(trails)
  4.  
  5. -- these 2 nested for loops get all of the Trails,names and prices
  6. for i, name in pairs(trails)do
  7.     if name:IsA("TextLabel") and name.Name == "Name" then
  8.         name.Text = name.Parent.Parent.Parent.Name
  9.         for i, prices in pairs(trails)do
  10.             if prices:IsA("TextLabel") and prices.Name == "Price" then
  11.                 prices.Text = prices.Parent.Parent.Parent:FindFirstChild("Price").Value.. " Robux"
  12.             end
  13.         end
  14.     end
  15. end
  16.  
  17. for i,v in pairs(trails)do
  18.     --print(trails) -- gets a table of all objects
  19.     --print(v)-- prints all objects
  20.     if v:IsA("Part") and v.Name == "TouchPad" then
  21.         for i, p in pairs(trails)do
  22.             v.Touched:Connect(function(hit)
  23.             local player = game.Players:GetPlayerFromCharacter(hit.Parent)         
  24.             local character = player.Character     
  25.             if p:IsA("Model") and v.Parent and debounce then
  26.             debounce = false   
  27.             --print(v.Parent)
  28.             --print(player)
  29.             --print(p.Value)
  30.                 local id = v.Parent:FindFirstChild("GamepassId").Value
  31.                 local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) 
  32.                 --  local ProductInfo = game:GetService("MarketplaceService"):GetProductInfo(id, Enum.InfoType.Product)
  33.                 --  local Price = ProductInfo.PriceInRobux     
  34.                     local success, errormessage = pcall(ownsGamepass);
  35.                     print(id)
  36.                     --  print(ProductInfo)
  37.                     print(ownsGamepass)
  38.                     --[[local function TrailNamePrice()
  39.                             for i, prices in pairs(trails)do
  40.                                 if prices:IsA("TextLabel") and prices.Name == "Price" then
  41.                                    if character:FindFirstChild("Trail")  and ownsGamepass then
  42.                                         v.Parent:FindFirstChild("GroupTag"):FindFirstChild("Frame"):FindFirstChild("Price").Text = "Equipped"          
  43.                                         print(prices.Parent "1")
  44.                                     end
  45.                                    
  46.                                     if not character:FindFirstChild("Trail") and ownsGamepass then
  47.                                         v.Parent:FindFirstChild("GroupTag"):FindFirstChild("Frame"):FindFirstChild("Price").Text = "Owned" 
  48.                                         print(prices.Parent "2")
  49.                                     end
  50.                                    
  51.                                     if not character:FindFirstChild("Trail") and not ownsGamepass then                     
  52.                                         prices.Text = prices.Parent.Parent.Parent:FindFirstChild("Price").Value.. " Robux"
  53.                                         print(prices.Parent "3")
  54.                                 end
  55.                             end
  56.                         end
  57.                     end
  58.                     TrailNamePrice()                   
  59.                 end--]]
  60.                     if player and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) ~= true then           
  61.                         local id2 = v.Parent:FindFirstChild("GamepassId").Value
  62.                         print(game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id))
  63.                         print("I dont own the gamepass ".. id2)
  64.                         game:GetService("MarketplaceService"):PromptGamePassPurchase(player,id)
  65.                         v.Parent:FindFirstChild("GroupTag"):FindFirstChild("Frame"):FindFirstChild("Price").Text = v.Parent.Price.Value " Robux"
  66.                     end
  67.                    
  68.                     if ownsGamepass and player then        
  69.                         for i, t in pairs(character:GetChildren())do
  70.                         if character.HumanoidRootPart:FindFirstChild("Attachment") then character.HumanoidRootPart.Attachment:Destroy() end
  71.                         if character.Head:FindFirstChild("Attachment") then character.Head.Attachment:Destroy() end
  72.                         if character.Torso:FindFirstChild("Attachment") then character.Torso.Attachment:Destroy() end
  73.                         if character:FindFirstChild(player.Name.."'s Trail") then character[player.Name.."'s Trail"]:Destroy() end
  74.                         if t:IsA("Trail") and t.Name == "Trail" and character:FindFirstChild("Trail") then
  75.                                 character:FindFirstChild("Trail"):Destroy()  
  76.                                 player:FindFirstChild("EquippedTrail").Value = ""
  77.                                 print("Destroying")
  78.                                 v.Parent:FindFirstChild("GroupTag"):FindFirstChild("Frame"):FindFirstChild("Price").Text = "Owned"
  79.                             break  
  80.                         end
  81.                            
  82.                         if not character:FindFirstChild("Trail") then
  83.                         local attachment1 = Instance.new("Attachment",character:FindFirstChild("HumanoidRootPart"))
  84.                         local attachment2 = Instance.new("Attachment",character:FindFirstChild("Head"))                            
  85.                         local trail = v.Parent:FindFirstChild("Trail"):Clone()
  86.                         trail.Parent = character
  87.                         trail.Attachment0 = attachment1
  88.                         trail.Attachment1 = attachment2
  89.                                 player:FindFirstChild("EquippedTrail").Value = v.Parent.Name
  90.                                 print("Cloning")                           
  91.                                 v.Parent:FindFirstChild("GroupTag"):FindFirstChild("Frame"):FindFirstChild("Price").Text = "Equipped"                          
  92.                               break
  93.                            end 
  94.                         end
  95.                      end--
  96.                  wait(1)
  97.                 debounce = true    
  98.               end  
  99.           end)
  100.        end
  101.     end
  102. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement