Basically this is a script in workspace so when a player dies if they have the gamepass a gui will show up after waiting 10 seconds. The code is below but it is not working, any help?
----------------------------------------------------------------------------------------------------
print("OnPlayerDeath script loading variables")
----------------------------------------------------------------------------------------------------
--Insert VARIABLES Below
----------------------------------------------------------------------------------------------------
local GamePassService = game:GetService("GamePassService")
local GamePassId = 185260715
----------------------------------------------------------------------------------------------------
print("OnPlayerDeath script working")
----------------------------------------------------------------------------------------------------
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
print("Someone Died")
if GamePassService:PlayerHasPass(player, GamePassId) then
wait(5)
print("They have game pass")
player.PlayerGui.MenuGUI.Menu.twoDoff.Visible = true
end
end)
end)
end)

4 comments
Did not work
Are you trying this online or with Play Solo?
Online
I'm not sure then, my apologies.