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

Gamepass Rainbow Trails Do Not Work?

Asked by 7 years ago

I made a script so that my donators could get VIP trails but it doesn't seem to work, can anyone see why?

This is where the parts for the script is. Eg the trail and script itself. http://imgur.com/gallery/D6Ezu

This is the script.

01local passIDs = {
02    971425430;
03    000000000
04}
05 
06function playerHasPass(plr)
07    for _,id in pairs(passIDs) do
08        if game.MarketplaceService:PlayerOwnsAsset(plr, id) then
09            return true
10        end
11    end
12    return false
13end
14 
15script.Parent.Touched:connect(function(hit)
View all 35 lines...

I'm not very good with scripts, so if anyone could find out, could you send me a script fix and a explanation please?

1 answer

Log in to vote
0
Answered by
2eggnog 981 Moderation Voter
7 years ago
Edited 7 years ago

The way your script is set up now will wait for a player who has the pass to touch the button, then it will give the trail to all future players who enter the server. You need to choose whether you want the VIP to given when they press the button, or when they enter the server, but not both.

Here's an example when they enter the server:

01...
02game.Players.PlayerAdded:Connect(function(player) --When a player enters..
03    if playerHasPass(plr) then --Check if they have the pass
04        player.CharacterAdded:Connect(function(char) --When their character spawns, give them the VIP trails.
05            local trail = game.ServerStorage.Trail:Clone()
06            trail.Parent = char.Head
07            local attachment0 = Instance.new("Attachment",char.Head)
08            attachment0.Name = "trailAttachment0"
09            local attachment1 = Instance.new("Attachment",char.Torso)
10            attachment1.Name = "TrailAttachment1"
11            trail.Attachment0 = attachment0
12            trail.Attachment1 = attachment1
13        end)
14    end
15end)

And here's one for a button press:

1script.Parent.Touched:connect(function(hit)
2    local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
3    if plr then
4        if playerHasPass(plr) then
5            --Do the trail stuff
6        end
7    end
8end
Ad

Answer this question