Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a particle gamepass for Roblox?

Okay so I am trying to make what I thought would be simple gamepass that gives the player a particle effect. Here is was I first had, which works.

       game.Players.PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(char)
        local Trail1 = Instance.new("Sparkles")
        Trail1.Parent = char:WaitForChild("Left Leg")
	    local Trail2 = Instance.new("Sparkles")
	    Trail2.Parent = char:WaitForChild("Right Leg")
    end)
end)

Then I tried adding this.

local passId = 573245655 -- change this to your game pass ID.

function isAuthenticated(player) -- checks to see if the player owns your pass

    return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
end
 
game.Players.PlayerAdded:connect(function(plr)
    if isAuthenticated(plr) then
        game.Players.PlayerAdded:connect(function(p)
    p.CharacterAdded:connect(function(char)
        local Trail1 = Instance.new("Sparkles")
        Trail1.Parent = char:WaitForChild("Left Leg")
	    local Trail2 = Instance.new("Sparkles")
	    Trail2.Parent = char:WaitForChild("Right Leg")
    end)
end)
    end
end)

But it didn't work, could someone please let me know what I am doing wrong here? And also if there is an easier way of doing this? Thanks!

2 comments

0

One thing I can really suggest would be just putting the trial into the players Torso. A problem I see is you have 2 PlayerAdded functions

0

The thing is, I want it to me coming from their feet not torso, is there's a better way I could be doing this?

1 answer

local passId = 573245655 -- change this to your game pass ID.

function isAuthenticated(player) -- checks to see if the player owns your pass
	return game:GetService("MarketplaceService"):PlayerOwnsAsset(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
	if isAuthenticated(plr) then
		plr.CharacterAdded:connect(function(char) --We don't need two PlayerAdded events because the first one already got the player.
			local Trail1 = Instance.new("Sparkles")
			Trail1.Parent = char:WaitForChild("Left Leg")
			local Trail2 = Instance.new("Sparkles")
			Trail2.Parent = char:WaitForChild("Right Leg")
		end)
	end
end)

Hope this helped, let me know if something is not working or errors.

3 comments

0

Thanks! I'll try this out for sure!

0

Okay, so it didn't work, would it be because I am testing it in Roblox studio?

0

Did you get any errors?

This discussion is preserved as it was. New answers, comments, and votes are closed.