|
| 05 Dec 2014 09:21 PM |
| Does FilteringEnabled cause game passes to not function normally? If so, how do I fix this? |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Dec 2014 09:25 PM |
Hmm, do you know what could be wrong with my game pass script then?
passId = 189618593
function onClicked(playerWhoClicked) local HasPass = game:GetService("GamePassService"):PlayerHasPass(playerWhoClicked, passId) if HasPass then --Grow Stuff else game:GetService("MarketplaceService"):PromptPurchase(playerWhoClicked, passId) end
Note that I put stuff in the comment, so there's something there in the actual script. Also I know it has something to do with the gamepass because when I remove the if statement stuff still happens. |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2014 09:26 PM |
| 1. there's no clicked event |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2014 09:26 PM |
Forgot this, I've had it though:
game.Workspace.Part.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2014 09:32 PM |
put a script inside the part and just do
mps = game:GetService'MarketplaceService' gamepassId = 000 script.Parent.ClickDetector.MouseClick:connect(function(click) --etc end) |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2014 09:35 PM |
What is the difference? I prefer having everything in one script, because it makes things with FilteringEnabled easier. (just my preference, I don't know if it actually makes a difference)
Is there any way I could do this in a LocalScript in StarterGui? |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2014 09:37 PM |
if you reference "workspace.Part" gl with that
you can put all those parts in a model and loop through or look into bindablevents |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2014 09:42 PM |
That's strange, because when I use game.Workspace.OBJECT for other things it works fine. Here's an example of what I did for something else:
local watermelonField = game.Workspace.WatermelonField
function watermelonFunction(x) function onClicked(playerWhoClicked) --Stuff works here end watermelonField["WatermelonPlot" .. x].ClickDetector.MouseClick:connect(onClicked) end
for i=1,4 do watermelonFunction(i) end
I'm assuming it has something to do with the Game Pass, because when I remove the if statement everything else works fine.
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 06 Dec 2014 04:55 PM |
| there's going to be 99999999999999 things with the name "Part" in workspace |
|
|
| Report Abuse |
|
|
|
| 06 Dec 2014 05:36 PM |
| That was just an example. It's not actually named "Part" |
|
|
| Report Abuse |
|
|
|
| 06 Dec 2014 11:10 PM |
I couldn't put the full script in a post, because it's way too long. That's why I made it up. Here's a tiny bit of it that I used for the gamepass (actual code (except for the comment) ):
passId = 189618593
function fertilizerFunction(x) function onClicked(playerWhoClicked) local HasPass = game:GetService("GamePassService"):PlayerHasPass(playerWhoClicked, passId) if HasPass then --Do Stuff-- else game:GetService("MarketplaceService"):PromptPurchase(playerWhoClicked, passId) end end fertilizerField["FertilizerPlot" .. x].ClickDetector.MouseClick:connect(onClicked) end
fertilizerFunction(1)
|
|
|
| Report Abuse |
|
|
| |
|
| |
|