I need a script where if you have DON'T have a game pass then it removes the "Health" script within your character that you get every time you spawn (game.Workspace.CHARACTERSNAME.Health). at this script does is allows your character to regenerate lost health over time. However, if they DO have the game pass then it does NOT remove this script.
How do I do this?
My Attempt:
gp = 162631986 Game.Players.PlayerAdded:connect(function(Player) if Game:GetService("GamePassService"):PlayerHasPass(Player, gp) then end else game.Workspace.Player.Health:remove() end
Attempt Two:
gp = 162631986 Game.Players.PlayerAdded:connect(function(Player) if Game:GetService("GamePassService"):PlayerHasPass(Player, gp) then return else game.Workspace.Player.Health:remove() end end)
Attempt Three:
gp = 162631986 wait(1) Game.Players.PlayerAdded:connect(function(Player) if Game:GetService("GamePassService"):PlayerHasPass(Player, gp) then return end p = Player.Name game.Workspace[p].Health:remove() end)
(Sorry, first time here. Didn't know the script attempt was required)
Good tries. Here's the fix to your problem.
local gp = 162631986 game.Players.PlayerAdded:connect(function(player) if Game:GetService("GamePassService"):PlayerHasPass(player, gp) then print("Game Pass Found") --If the user has game pass we just print they have it. else print("Game Pass Not Found -- Health Destroyed") char:WaitForChild("Health"):Destroy() --If they don't, we wait for the 'Health' script and then destroy it. end end)