Saving Tower Completion Data

Hey! I’m currently developing a unique game similar to Juke’s Towers of Hell and am beginning work on a DataStore system. The problem I am having is that I cannot figure out how to prevent a player from obtaining points by beating the same tower multiple times. They should receive 1 Tower point from beating the Tower the first time. I would appreciate a little nudge in the right direction on how to read if a player has already beaten a Tower.

1 Like

You could probably use something like this:

local playerBeatTower = false
game.TowerEnd.Touched:Connect(function(hit)
   if hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
      local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
      if not playerBeatTower then
         plr.leaderstats.Wins.Value += 1
          playerBeatTower = true
      end
   end
end)

Hope this helps!