Destr0iJoin Date: 2014-04-29 Post Count: 13305 |
I want this script to only work for people who have a specific gamepass, and if they dont have the gamepass the purchase feature pops up
I got the script down already, I dont know how to do the VIP part..
clickdetector = script.Parent:FindFirstChild("ClickDetector") -- Put script in same part as clickdetector
toolname = "Pistol" -- Change this to tool's name
tool = game.ServerStorage:FindFirstChild(toolname) -- Change this to the location where the tool is located in
clickdetector.MouseClick:connect(function(player)
nevermind = false
if player:FindFirstChild("Backpack") ~= nil then
if player.Backpack:FindFirstChild(toolname) then
nevermind = true
end
end
if player.Character then
if player.Character:FindFirstChild(toolname) then
nevermind = true
end
end
if not nevermind then
if player:FindFirstChild("Backpack") then
tool:clone()
tool.Parent = player:FindFirstChild("Backpack")
end
end
end)
--Never forget. |R$232 |
|
Destr0iJoin Date: 2014-04-29 Post Count: 13305 |
It already works btw, nothing needs fixing, I just need to add on the vip part.
Never forget. |R$232 |
|
later_kJoin Date: 2016-02-25 Post Count: 2776 |
|
|
Destr0iJoin Date: 2014-04-29 Post Count: 13305 |
well I got there and
"There is currently no text in this page. You can search for this page title in other pages, or search the related logs, but you do not have permission to create this page."
Never forget. |R$232 |
|
domorox17Join Date: 2012-03-06 Post Count: 1710 |
@epic No need for that. Use the PlayerHassPass() method, which is part of GamePassService. |
|
Destr0iJoin Date: 2014-04-29 Post Count: 13305 |
PlayerHasPass?
would it also do this part
"and if they dont have the gamepass the purchase feature pops up"
Never forget. |R$232 |
|
later_kJoin Date: 2016-02-25 Post Count: 2776 |
PlayerOwnsAsset has always worked for me, I don't see why not to use it :P
Also, http://wiki.roblox.com/index.php?title=PromptPurchase_(Method) |
|
Destr0iJoin Date: 2014-04-29 Post Count: 13305 |
tried something out with both of those
would this work? any ID is just stated as ID.
clickdetector = script.Parent:FindFirstChild("ClickDetector") -- Put script in same part as clickdetector
toolname = "Pistol" -- Change this to tool's name
tool = game.ServerStorage:FindFirstChild(toolname) -- Change this to the location where the tool is located in
clickdetector.MouseClick:connect(function(player)
nevermind = false
game.Players.PlayerAdded:connect(function(plr)
if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,ID) then
if player:FindFirstChild("Backpack") ~= nil then
if player.Backpack:FindFirstChild(toolname) then
nevermind = true
end
end
if player.Character then
if player.Character:FindFirstChild(toolname) then
nevermind = true
end
end
if not nevermind then
if player:FindFirstChild("Backpack") then
tool:clone()
tool.Parent = player:FindFirstChild("Backpack")
end
end
end)
else
id = ID --Beautiful Hair for Beautiful People
game.Players.PlayerAdded:connect(function(player)
game:GetService("MarketplaceService"):PromptPurchase(player,id)
end)
end
end)
--Never forget. |R$232 |
|
later_kJoin Date: 2016-02-25 Post Count: 2776 |
I don't recommend just copy and pasting stuff from the wiki.
clickdetector = script.Parent:FindFirstChild("ClickDetector") -- Put script in same part as clickdetector
toolname = "Pistol" -- Change this to tool's name
tool = game.ServerStorage:FindFirstChild(toolname) -- Change this to the location where the tool is located in
clickdetector.MouseClick:connect(function(player)
nevermind = false
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,YourID) then
if player:FindFirstChild("Backpack") ~= nil then
if player.Backpack:FindFirstChild(toolname) then
nevermind = true
end
end
if player.Character then
if player.Character:FindFirstChild(toolname) then
nevermind = true
end
end
if not nevermind then
if player:FindFirstChild("Backpack") then
tool:clone()
tool.Parent = player:FindFirstChild("Backpack")
end
end
else
game:GetService("MarketplaceService"):PromptPurchase(player,YourID)
end)
end)
|
|
later_kJoin Date: 2016-02-25 Post Count: 2776 |
Sorry, messed that up slightly.
Just take off the ) on the first "end)" |
|
Destr0iJoin Date: 2014-04-29 Post Count: 13305 |
alright, thanks
Never forget. |R$232 |
|