its a serverscriptservice for some reason it wont work.
pcall(function() game.Players.PlayerAdded:connect(function(player) if game.GamePassService:PlayerHasPass(player,340209466) then local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name) cashmoney.Value = cashmoney.Value + 5000 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.SpaceSword:Clone().Parent=player.Backpack end end) elseif game.GamePassService:PlayerHasPass(player,340204818) then local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name) cashmoney.Value = cashmoney.Value + 1000 player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then game.Lighting.FrostSword:Clone().Parent=player.Backpack end end)
You were missing a few ends. It will also help if you tab your code properly. You also should not need pcall. This is what will mask any errors you may have, and prevent you or us from finding them.
Make sure you have an end
for every function, if then statement, and loop.
game.Players.PlayerAdded:connect(function(player) --You were missing an end for this function. if game.GamePassService:PlayerHasPass(player,340209466) then --You were also missing an end for this if then statement. local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name) cashmoney.Value = cashmoney.Value + 5000 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.SpaceSword:Clone().Parent=player.Backpack end end) elseif game.GamePassService:PlayerHasPass(player,340204818) then local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name) cashmoney.Value = cashmoney.Value + 1000 player.CharacterAdded:connect(function(char) if char:WaitForChild("Humanoid") then game.Lighting.FrostSword:Clone().Parent=player.Backpack end end) end end)
I'd suggest using a wait
function for the player to fully load.
game.Players.PlayerAdded:connect(function(player) if game.GamePassService:PlayerHasPass(player,340209466) then local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name) cashmoney.Value = cashmoney.Value + 5000 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.SpaceSword:Clone().Parent=player.Backpack end end) elseif game.GamePassService:PlayerHasPass(player,340204818) then local cashmoney = game.ServerStorage.MoneyStorage:WaitForChild(player.Name) cashmoney.Value = cashmoney.Value + 1000 if char:WaitForChild("Humanoid") then game.Lighting.FrostSword:Clone().Parent=player.Backpack end end end)