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

Gamepass function not running?

Asked by 6 years ago
local player1 = script.Parent
local trail = game.ReplicatedStorage.TrailMachine
mps= game:GetService("MarketplaceService")
function createMachine()
    local trailClone = trail:Clone()
    trailClone.PrimaryPart = trailClone.Core
    trailClone.Parent = player1
    trailClone:moveTo(player1.Torso.Position)

    local weld = Instance.new("Motor6D")
    weld.Parent = trailClone.Core
    weld.Part0 = trailClone.Core
    weld.Part1 = player1.Torso
end
game:GetService("Players").PlayerAdded:Connect(function(player)
    if mps:UserOwnsGamePassAsync(player.UserId,5260848) then
        createMachine(player)
    end
end)

Even though I tested it in the place, and since I'm the owner I have the gamepass, it still didn't make the model. Maybe this is because the place is private and only I can play it?

0
is "player1" the player's character or the player's player? Astralyst 389 — 6y
0
why don't you just do player.Character instead of player1? Astralyst 389 — 6y
0
True, still looking for a answer. Starflyerz 44 — 6y

1 answer

Log in to vote
0
Answered by
brok4d 77
6 years ago
Edited 6 years ago

And you put it in ServerServiceScript

local trail = game.ReplicatedStorage.TrailMachine
local mps = game:GetService("MarketplaceService")

game:GetService("Players").PlayerAdded:Connect(function(player)
    if mps:UserOwnsGamePassAsync(player.UserId,5260848) then
        local function createMachine()
            local trailClone = trail:Clone()
            trailClone.PrimaryPart = trailClone.Core
            trailClone.Parent = player.Character
            trailClone:moveTo(player.Torso.Position)

            local weld = Instance.new("Motor6D")
            weld.Parent = trailClone.Core
            weld.Part0 = trailClone.Core
            weld.Part1 = player.Character.Torso
        end
        createMachine(player)
    end
end)

Ad

Answer this question