Leaderboard Script
local stats = {"value", "Omegite"} game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" for _, stat in pairs(stats) do Instance.new("IntValue", leaderstats).Name = stat end end)
Take this as a question and not a request. I would like to detect when a red or blue team member captures the flag and adds a point to a intvalue
which is in workspace. What events would I use to detect when someone has captured a flag?
FYI: The game I have makes you spawn in a lobby and picks a map after 25 seconds of waiting in the lobby.
Just use a touched event on the capture platform, then see if they're holding the enemy flag (which I assume is being placed in your character.) From there, you can change the value in workspace. Something like,
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("EnemyFlag") then workspace.IntValue.Value = workspace.IntValue.Value + 1 end end
Of course, if you don't have a way of respawning the flag, this will run multiple times and give too many captures.