pcall(function() game.Players.PlayerAdded:connect(function(player) if game.GamePassService:PlayerHasPass(player,574426548) then player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 10 char.Humanoid.Health = char.Humanoid.Health + 10 game.Lighting.WoodenSword:Clone().Parent=player.Backpack end end) elseif game.GamePassService:PlayerHasPass(player,574427239) then player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 25 char.Humanoid.Health = char.Humanoid.Health + 25 game.Lighting.SubspaceTripmine:Clone().Parent=player.Backpack end end) elseif game.GamePassService:PlayerHasPass(player,574430612) then player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 50 char.Humanoid.Health = char.Humanoid.Health + 50 game.Lighting.EpicKatana:Clone().Parent=player.Backpack end end) elseif game.GamePassService:PlayerHasPass(player,574437515) then player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 75 char.Humanoid.Health = char.Humanoid.Health + 75 game.Lighting.RayGunBio:Clone().Parent=player.Backpack end end) elseif game.GamePassService:PlayerHasPass(player,574439700) then player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 100 char.Humanoid.Health = char.Humanoid.Health + 100 game.Lighting.Phoenix:Clone().Parent=player.Backpack end end) elseif game.GamePassService:PlayerHasPass(player,574441188) then player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 200 char.Humanoid.Health = char.Humanoid.Health + 200 game.Lighting["Ro-Orb"]:Clone().Parent=player.Backpack game.Lighting.Darkheart:Clone().Parent=player.Backpack end end) end end) end)
script will not give the player what he bought please help.
The way your code is written, the first gamepass that the Player has purchased, in the order you have typed them, is the only one they get. elseif
doesn't trigger if a previous if
or elseif
in the same 'tree' triggered:
pcall(function() game.Players.PlayerAdded:connect(function(player) if game.GamePassService:PlayerHasPass(player,574426548) then player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 10 char.Humanoid.Health = char.Humanoid.Health + 10 game.Lighting.WoodenSword:Clone().Parent=player.Backpack end end) end if game.GamePassService:PlayerHasPass(player,574427239) then player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 25 char.Humanoid.Health = char.Humanoid.Health + 25 game.Lighting.SubspaceTripmine:Clone().Parent=player.Backpack end end) end if game.GamePassService:PlayerHasPass(player,574430612) then player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 50 char.Humanoid.Health = char.Humanoid.Health + 50 game.Lighting.EpicKatana:Clone().Parent=player.Backpack end end) end if game.GamePassService:PlayerHasPass(player,574437515) then player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 75 char.Humanoid.Health = char.Humanoid.Health + 75 game.Lighting.RayGunBio:Clone().Parent=player.Backpack end end) end if game.GamePassService:PlayerHasPass(player,574439700) then player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 100 char.Humanoid.Health = char.Humanoid.Health + 100 game.Lighting.Phoenix:Clone().Parent=player.Backpack end end) end if game.GamePassService:PlayerHasPass(player,574441188) then player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 200 char.Humanoid.Health = char.Humanoid.Health + 200 game.Lighting["Ro-Orb"]:Clone().Parent=player.Backpack game.Lighting.Darkheart:Clone().Parent=player.Backpack end end) end end) end)