Okay, so I have a program that gives a gun to a player, if they have the game pass, but now, it won't even run, without an error code. Here is the code, but that probably won't help, as it use to work just fine, and I made sure it wasn't disabled.
local passId = 168101268 gun = game.Lighting.Turret print ('started to give a gun') function isAuthenticated(player) return game:GetService("GamePassService"):PlayerHasPass(player, passId) end game.Players.PlayerAdded:connect(function(plr) if isAuthenticated(plr) then print 'giving gun' local newgun = gun:clone() newgun.Parent = plr.Backpack newgun.Parent = plr.StarterGear print 'gun givin' end end)
it's weird, becuase it worked just fine yesterday, but today, it just stopped working today. Does anyone have any ideas?
You change it's parent twice. Since the last thing you changed it to was StarterGear, that's where the gun will be.
It's also possible that the script runs before the gun exists. Fix this by doing
gun = game.Lighting:WaitForChild("Turret")
Make sure you do not test this is PlaySolo, because PlayerAdded events don't fire in PlaySolo. On top of that, you won't own the pass in PlaySolo.