When the part is touched this script is supposed to look for players in the game in the same accepted group as the player that touched the part and give them money. However it everyone money when the part is touched. Where am I going wrong? Thank you for your time!! :)
local marcano = 2959195
local police = 3003695
local point = script.Parent
point.Touched:connect(function(part)
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
print ('The capture point was touched')
if plr then
if plr:IsInGroup(police) or plr:IsInGroup(marcano) then
print ('The player is in an accepted group')
for _,v in pairs(game.Players:GetChildren()) do
if v:IsInGroup(police) or v:IsInGroup(marcano) then
v.Wealth.Money.Value = v.Wealth.Money.Value + 100
else
print ('The player is not in an accepted group!')
end
end
end
end
end)

1 comment
Can you tab your code correctly, this is a real pain to read :/