Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to make your own particle game pass?

Asked by 7 years ago
Edited 7 years ago

I am trying to create my own particle for players to buy a gamepass and get.

I have the premade particles from roblox working. Script:

01local passId = 000000000
02 
03function isAuthenticated(player)
04    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
05end
06 
07game.Players.PlayerAdded:connect(function(plr)
08    if isAuthenticated(plr) then
09        plr.CharacterAdded:connect(function(char)
10            local Trail1 = Instance.new("Sparkles")
11            Trail1.Parent = char:WaitForChild("Left Leg")
12            local Trail2 = Instance.new("Sparkles")
13            Trail2.Parent = char:WaitForChild("Right Leg")
14        end)
15    end
16end)

And I have created my custom particle and placed it in replicated storage, I used this script to test it for when I touch a block.

01local rs = game:GetService("ReplicatedStorage")
02 
03function onTouch(hit)
04    local ee = rs.ParticleEmitter:Clone()
05 
06    if hit.Parent.Torso:FindFirstChild("ParticleEmitter")then
07        hit.Parent.Torso.ParticleEmitter:remove()
08    end
09    ee.Parent = hit.Parent.Torso
10    end
11 
12script.Parent.Touched:connect(onTouch)

But no I am trying to make it so that you get my custom particle when you purchase a gamepass, this is what I have so far, and I am not sure what to do from now.

1local passId = 000000000
2 
3function isAuthenticated(player)
4    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
5end
6 
7local particles = game.ReplicatedStorage.Particles
8game.Players.PlayerAdded:connect(function(plr)
9    if isAuthenticated(plr) then

Any help would be much apreciated thank you :)

1 answer

Log in to vote
1
Answered by 7 years ago

Instead of using MarketPlaceService to check if a player has a gamepass you should use GamePassService. And check if they have the pass in the function itself. So then your first block of code would look like this

01local passId = 000000000
02local GamePassService = game:GetService('GamePassService')
03 
04    game.Players.PlayerAdded:connect(function(plr)
05    if GamePassService:PlayerHasPass(plr,passId) then
06            plr.CharacterAdded:connect(function(char)
07                local Trail1 = Instance.new("Sparkles")
08                Trail1.Parent = char:WaitForChild("Left Leg")
09                local Trail2 = Instance.new("Sparkles")
10                Trail2.Parent = char:WaitForChild("Right Leg")
11            end)
12        end
13    end)

Your second script looks fine

Your last script is it meant to suddenly end at 'then' because then it wont work.

0
No I'm not sure what to do after 'then' Pot8o_Penguin 50 — 7y
Ad

Answer this question