Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local trails = script.Parent:GetDescendants()
- local debounce = true
- --print(trails)
- -- these 2 nested for loops get all of the Trails,names and prices
- for i, name in pairs(trails)do
- if name:IsA("TextLabel") and name.Name == "Name" then
- name.Text = name.Parent.Parent.Parent.Name
- for i, prices in pairs(trails)do
- if prices:IsA("TextLabel") and prices.Name == "Price" then
- prices.Text = prices.Parent.Parent.Parent:FindFirstChild("Price").Value.. " Robux"
- end
- end
- end
- end
- for i,v in pairs(trails)do
- --print(trails) -- gets a table of all objects
- --print(v)-- prints all objects
- if v:IsA("Part") and v.Name == "TouchPad" then
- for i, p in pairs(trails)do
- v.Touched:Connect(function(hit)
- local player = game.Players:GetPlayerFromCharacter(hit.Parent)
- local character = player.Character
- if p:IsA("Model") and v.Parent and debounce then
- debounce = false
- --print(v.Parent)
- --print(player)
- --print(p.Value)
- local id = v.Parent:FindFirstChild("GamepassId").Value
- local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id)
- -- local ProductInfo = game:GetService("MarketplaceService"):GetProductInfo(id, Enum.InfoType.Product)
- -- local Price = ProductInfo.PriceInRobux
- local success, errormessage = pcall(ownsGamepass);
- print(id)
- -- print(ProductInfo)
- print(ownsGamepass)
- --[[local function TrailNamePrice()
- for i, prices in pairs(trails)do
- if prices:IsA("TextLabel") and prices.Name == "Price" then
- if character:FindFirstChild("Trail") and ownsGamepass then
- v.Parent:FindFirstChild("GroupTag"):FindFirstChild("Frame"):FindFirstChild("Price").Text = "Equipped"
- print(prices.Parent "1")
- end
- if not character:FindFirstChild("Trail") and ownsGamepass then
- v.Parent:FindFirstChild("GroupTag"):FindFirstChild("Frame"):FindFirstChild("Price").Text = "Owned"
- print(prices.Parent "2")
- end
- if not character:FindFirstChild("Trail") and not ownsGamepass then
- prices.Text = prices.Parent.Parent.Parent:FindFirstChild("Price").Value.. " Robux"
- print(prices.Parent "3")
- end
- end
- end
- end
- TrailNamePrice()
- end--]]
- if player and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) ~= true then
- local id2 = v.Parent:FindFirstChild("GamepassId").Value
- print(game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id))
- print("I dont own the gamepass ".. id2)
- game:GetService("MarketplaceService"):PromptGamePassPurchase(player,id)
- v.Parent:FindFirstChild("GroupTag"):FindFirstChild("Frame"):FindFirstChild("Price").Text = v.Parent.Price.Value " Robux"
- end
- if ownsGamepass and player then
- for i, t in pairs(character:GetChildren())do
- if character.HumanoidRootPart:FindFirstChild("Attachment") then character.HumanoidRootPart.Attachment:Destroy() end
- if character.Head:FindFirstChild("Attachment") then character.Head.Attachment:Destroy() end
- if character.Torso:FindFirstChild("Attachment") then character.Torso.Attachment:Destroy() end
- if character:FindFirstChild(player.Name.."'s Trail") then character[player.Name.."'s Trail"]:Destroy() end
- if t:IsA("Trail") and t.Name == "Trail" and character:FindFirstChild("Trail") then
- character:FindFirstChild("Trail"):Destroy()
- player:FindFirstChild("EquippedTrail").Value = ""
- print("Destroying")
- v.Parent:FindFirstChild("GroupTag"):FindFirstChild("Frame"):FindFirstChild("Price").Text = "Owned"
- break
- end
- if not character:FindFirstChild("Trail") then
- local attachment1 = Instance.new("Attachment",character:FindFirstChild("HumanoidRootPart"))
- local attachment2 = Instance.new("Attachment",character:FindFirstChild("Head"))
- local trail = v.Parent:FindFirstChild("Trail"):Clone()
- trail.Parent = character
- trail.Attachment0 = attachment1
- trail.Attachment1 = attachment2
- player:FindFirstChild("EquippedTrail").Value = v.Parent.Name
- print("Cloning")
- v.Parent:FindFirstChild("GroupTag"):FindFirstChild("Frame"):FindFirstChild("Price").Text = "Equipped"
- break
- end
- end
- end--
- wait(1)
- debounce = true
- end
- end)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement