Server Script in ServerScriptService:
local ServerStorage = game.ServerStorage.RainbowTrail:Clone()
local gamepassid = 10498381
game.Players.PlayerAdded:Connect(function(plr)
local gamepassOwned = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, gamepassid)
plr.CharacterAdded:Connect(function(char)
if gamepassOwned then
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
ServerStorage.Parent = char.Head
local attachment0 = Instance.new("Attachment",char.Head)
attachment0.Name = "TrailAttachment0"
local attachment1 = Instance.new("Attachment",char.HumanoidRootPart)
attachment1.Name = "TrailAttachment1"
ServerStorage.Attachment0 = attachment0
ServerStorage.Attachment1 = attachment1
end)
end)
end
end)
end)
This script worked before I added the gamepass needing to be required.
Trail in ServerStorage: https://prnt.sc/tjsdfc

3 comments
Thank you so much!
For some reason the trail only works on 1 player at a time. Ex: I had the trail, my friend joined, my trail got deleted and the trail went to him.
Wow, I'm late sorry. To fix that simply remove ":Clone()" From ServerStorage and add it to the "attach" function. attach(ServerStorage:Clone(), {chr.Head, chr.HumanoidRootPart}). Sorry for the mistake.