My Type: Beginner At Scripting
Objective: Trying to make a script where if you go to the winner’s team you’ll get points once, but if you go to the neutral team you won’t get any points unless you go back to the winner’s team.
I’m trying to make a script where if you go to the finish line then you’ll get points, but the problem is, I tried making it so that if you touch it you’ll get points but this will make the player touch it all over again which will cause them to have unlimited points.
So, I tried another option where you’ll get points once if you’re in the winner’s team and you can’t get them again unless you go back to the neutral team and go back to the finish line.
So, I tried making the script and it worked well, but the problem is that it gives you cash each one second, and I only wanted it to give you cash once. I tried removing “while true do”, but it seems like it didn’t work.
game.Players.PlayerAdded:Connect(function(player)
while true do
wait(1)
local Award
if player.TeamColor == BrickColor.new("Bright red") then --Bright red is the winner's team
Award = 2500
else --If you go back to the neutral team then you won't get any points unless you go back to the winner's team
Award = 0
end
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + Award
end
end)
(Sorry if I explained this really badly, I’m pretty bad at explaining)