Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make a "You won!" GUI come up if you had gotten the most kills in an amount of time?

Asked by 2 years ago
Edited 2 years ago

So I am making a simple starter fighting game where you can buy new weapons and level up, that isn't the problem. I just can't seem to think up a script that would connect to my leaderstats within my game that actually works???

The script for my leaderstats is below:

  1. game.Players.PlayerAdded:Connect(function(player)
  2. local leaderstats = Instance.new("Folder", player)
  3. leaderstats.Name = "leaderstats"
  4. local kills = Instance.new("NumberValue", leaderstats)
  5. kills.Name = "Kills"
  6. kills.Value = 0
  7. local deaths = Instance.new("NumberValue", leaderstats)
  8. deaths.Name = "Deaths"
  9. deaths.Value = 0
  10. player.CharacterAdded:Connect(function(character)
  11. local humanoid = character:FindFirstChild("Humanoid")
  12. humanoid.Died:Connect(function(died)
  13. deaths.Value = deaths.Value + 1
  14. local tag = humanoid:FindFirstChild("creator")
  15. local killer = tag.Value
  16. if tag and killer then
  17. killer.leaderstats:FindFirstChild("Kills").Value = killer.leaderstats:FindFirstChild("Kills").Value + 1
  18. end
  19. end)
  20. end)
  21. end)

Anyway, thanks for reading this.

0
The intermission time is 20 seconds and the game time is 240 (4 minutes). EmJay10101 9 — 2y
0
I would say, though I can't say as a sure answer, make a NumberValue that counts up every second, and if the kills are a certain amount, and the time is equal to or under the max time you want, that should do it. data_recovery -5 — 2y
0
Hm, I will try it, thanks for your help. EmJay10101 9 — 2y
0
I still wouldnt mind more ideas. I was thinking more of an, "Get as many kills as you can," i dont really want a certain amount to get to then the whole thing finishes. If i dont get anymore suggestions, i will use yours. Thanks again. EmJay10101 9 — 2y

Answer this question