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

If Player Touches Part And Has GamePass Gets Trail?

Asked by 5 years ago
Edited 5 years ago

I'm Trying To figure out how to do it but it's not working, can Someone give me a help, I want to script when player touches the brick and if he has the gamepass he gets a trail, Thanks!

game.Players.PlayerAdded:Connect(function(plr)
    if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,5647766) then

         script.Parent.Touched:Connect(function(parttouched)
        local humanoid = parttouched.Parent:FindFirstChild("Humanoid")

    if humanoid ~= nil then
        local char = humanoid.Parent
        local trail = game.ServerStorage.Blue:Clone()
            trail.Parent  = char.Head
            local attachment0 = Instance.new("Attachment", char.Head)
            attachment0.Name = "TrailAttachment0"
        local attachment1 = Instance.new("Attachment", char.HumanoidRootPart)
            attachment1.Name = "TrailAttachment0"
        trail.Attachment0 = attachment0
        trail.Attachment1 = attachment1

    else 
        print(plr.Name .. " player doesn't have game pass")
        end
        end)
    end
    end)
0
You code will connect an new event for every player that has the game pass. Meaning you give it out to all players. User#5423 17 — 5y
0
I'm Getting Errors That I Have To Use PlayerOwnsAsset, Even Though, I'm Using, Why? ItzJester2 12 — 5y

Answer this question