Hello everyone, I have a GamepassHandler script in ServerScriptService. The script is meant to give Cash, Gear, Health, Speed, or maybe one in specific if you have the required Gamepass. I have it all set-up but when I test it in Studio and on a live server I don't get ANYTHING even though I have all 3 Gamepasses since I made the game. I was wondering what was wrong with the script, and maybe a correction on how to fix it?
Script:
pcall(function()
game.Players.PlayerAdded:connect(function(player)
if game.GamePassService:PlayerHasPass(player,253570419) then
local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name)
cashmoney.Value = cashmoney.Value + 10000
player.CharacterAdded:connect(function(char)
if char:WaitForChild("Humanoid") then
char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 25
char.Humanoid.Health = char.Humanoid.Health + 25
char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed + 8
game.Lighting.GalacticMinigun:Clone().Parent=player.Backpack
end
end)
local msg = Instance.new("Hint",workspace)
msg.Text = player.Name.." joined the game with Ultra V.I.P."
wait(2)
msg:Destroy()
if game.GamePassService:PlayerHasPass(player,253577465) then
local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name)
cashmoney.Value = cashmoney.Value + 2500
player.CharacterAdded:connect(function(char)
if char:WaitForChild("Humanoid") then
char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 5
char.Humanoid.Health = char.Humanoid.Health + 5
char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed + 2
game.Lighting.RedHyperLaser:Clone().Parent=player.Backpack
end
end)
local msg = Instance.new("Hint",workspace)
msg.Text = player.Name.." joined the game as a V.I.P."
wait(2)
msg:Destroy()
if game.GamePassService:PlayerHasPass(player,253578269) then
local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name)
cashmoney.Value = cashmoney.Value + 10000
local msg = Instance.new("Hint",workspace)
msg.Text = player.Name.." joined with 10,000 Cash."
wait(2)
msg:Destroy()
end
end)
end)
