Hi, I made a gamepass that give a tool that makes the person invincible for 15 seconds. Once the tool is activated (onActivated) The tool will make his health and max health to 9999999999999999999 and will kill anything that touch him. The tool also sets the speed to 30 for 15 seconds. Now, the problem is that I made 2 other gamepasses previously: 1 sets his health and max health to 250 instead of 100 and the other one sets his walkspeed to 25 instead of 16. So when the tool time expires, I put the max health and health back to 100 and the walkspeed back to 16. I need help to set the health back to 250 for players who bought the health boost gamepass and also to set the speed back to 25 for the players has the walkspeed gamepass. The only I know to do it is to reset, but it's not what I want.
Here's the walkspeed and health gamepass :
local id = 321583736 -- Gamepass ID
game.Players.PlayerAdded:connect(function(newplayer)
newplayer.CharacterAdded:connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
if game:GetService("GamePassService"):PlayerHasPass(newplayer, id) then
humanoid.WalkSpeed = 25
end
end)
end)
wait(2)
gpid = 330461815 -- Gamepass ID
health = 250 -- Health
GPS = Game:GetService("GamePassService")
function respawned(char)
player = game.Players:FindFirstChild(char.Name)
if char:FindFirstChild("Head") ~= nil then
if GPS:PlayerHasPass(player, gpid) then
char.Humanoid.MaxHealth = health
char.Humanoid.Health = health
else
end
end
end
game.Workspace.ChildAdded:connect(respawned)
Thanks for the help.

1 comment
I tried puting the line 1, the line 5 to the line 8 in of the walkspeed gamepass to the script but it didn't worked. I tried puting from line 3 to 6 , and from line 8 to 12 for the health but it also didn't wolrked.