Hide and Seek Tag: Tagging system

Hello! I'm ZuIu and I'm currently working on a Hide and Seek Tag game.

The game is in its very early stages and I have somethings that are missing. The most important feature missing would be tagging someone! I already have a system down that selects a random person out of the players to be a seeker, while the rest are hiders.

I wanted to script something that would allow the seeker to chase down other hiders and if they collide, the seeker tags them and they are out! I'm not sure where to start when creating this tagging system. I was thinking of somehow detecting when the seeker touches a player, but I couldn't figure that out through the discord. I went here for your help!

If there are any ideas on how I could script a way for tagging a player, let me know!

Hi! Sorry that I couldn't respond sooner.

I would go about this by giving the seeker a gun, and when they shoot someone, it deals a single damage point. Then you could find who sent the damage and if it was the seeker (preventing exploiting), then that person is either infected and put on a team with the seeker, or if they are out, then send them to a spectator platform!

Hope this helped! :heart:

I would suggest attaching triggers to the player's hands that "tag" another player when entered.

Below is an image of what this would look like in the hierarchy. You would have the "GameHandler" script which takes care of scoring etc., the "Tag Handler Script" which would send a "Player Tagged" event when players tag another, the "TagEquipment" which when worn would make players a tagger, and the "Trigger Area" a child of the "TagEquipment" which should be just large enough to cover the player's hands (when another player enters the trigger area, they are tagged).

Tag Handler Script (networked)
TagEquipment (networked)
|----Trigger Area (networked)

Tag Handler Script Below:

-- This is a reference to the trigger that the player will wear on their hands to tag other players
    local equipment = script:GetCustomProperty("tagEquipment")
    -- This is a reference to the trigger area that the player wears on their hands
    local tagArea = script:GetCustomProperty("tagSphere)
    -- This is used to select a "random" player to make the tagger
    function GetFirstPlayer()
        return game.GetPlayers()[0]

-- Attaches the tag equipment to the first player allowing them to tag others

function OnEnterTrigger(trigger, object)
-- Sends and event that a player has been tagged
    if(object:IsA("Player") and object ~= equipment.owner) then
        Events.Broadcast("Player Tagged",  object)


Game Handler Script (goes into a server context folder):

function OnPlayerTagged(player)
    -- Do something to this player

Events.Connect("Player Tagged", OnPlayerTagged)