✓ Accepted answer
**Problem: **
You seemed to not fill in the parameters of the :PlayerHasPass() . I also don't know how you want the script to give the player the tool whether it be upon joining or not so I did that. You also seem to be doing the cloning process wrong.
Solution:
I just added the parameters in their rightful place and added a PlayerAdded event. I fixed your cloning problem.
Code:
local id = 0000000
game.Players.PlayerAdded:connect(function(player)
if Game:GetService("GamePassService"):PlayerHasPass(player, id) then
local clone = game.ServerStorage.VoidSword:Clone()
clone.Parent = player:WaitForChild("Backpack")
print(player.Name .. " has the game pass!")
else
print(player.Name .. " doesn't have the game pass...")
end
end)
If you have questions don't be afraid to ask and I will be glad to answer. If this helped you don't forget to accept my answer.
4 comments
Thanks for the solution!
No problem
The script worked when the player joined the game, but when the player dies, the tool doesn't get cloned into the player's inventory again
How do I make the same code except use a different tool?