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

Gamepass function not running?

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?

3 comments

0

is "player1" the player's character or the player's player?

0

why don't you just do player.Character instead of player1?

0

True, still looking for a answer.

1 answer

✓ Accepted answer

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)

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