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

How do you make a gamepass give a hat?

Asked by 9 years ago

I need to be able to make a gamepass give the player a hat whenever they join, and put it automatically put it on their back (it's a swordpack)

1 answer

Log in to vote
0
Answered by 9 years ago

See if this script can help you.

GamePassId = --YourGamePassId

game.Players.PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function() 
        if game:GetService("GamePassService"):PlayerHasPass(Player, GamePassId) then
            x = game.ServerStorage.YourBackSwords:Clone() --Save your "Swords" there <---
            x.Parent = Player.Character
            m = Instance.new("Motor6D", Player.Character.Head)
            m.Part0 = Player.Character.Head
            m.Part1 = x
            m.C1 = CFrame.fromEulerAnglesXYZ(0, 0, 0) *CFrame.new(0, 0, 0) --Play with the Position and Rotation of the Part
        end
    end)
end)
Ad

Answer this question