Give tag to local player and not others after touching a part?

I have been trying to figure out how to add a tag to the local player when touching a part, basically when they win, I’ve tried different ways yet i couldnt figure it out, any help would be appreciated!

[ i also have tried setting attributes but didnt work ]

( This is my first post ever )

1 Like

You need to have a server side and local side, communicating when the player has won using RemoteEvents

ooooh, so is this basically the only way i could do it?

  • Im a beginner (3 months now) but i can understand stuff quite easily :slight_smile:

Anyways, so remote events, ive used them before already relating to a similar issue but i fixed it, so would i have to make a remote event to give the tag to that specific player using collection service?

1 Like

You could use attributes or tags, either works. Although you should ensure the player actually made it to the end by doing a hitbox check in the end zone

hmmm, well they do touch the part, and it would only fire the remote event on client if they touched it ( runs on local script ), also wdym by doing a hitbox check (im look it up on here but feel free to explain ) :slight_smile:

Roblox does the thing that no other sane coding language does, trusting the client (sad ik), meaning the client can easily fly and teleport around

Not as much as an issue for small games, but it’s something to be aware of

ooooh, well i think ill fix the issue for now with the remote event and add a tag on it, ill come back to you later if it worked if thats cool with you :smile:

oh ok thx for the tip tho, really helpfull

yo, i cant remove the tag from the player, and ive looked around everywhere for an answer but it doesnt help, you think you could help me?

Are you able to do this on the server or is this tied with some other client stuff

Call :RemoveTag(“Your_tag_here”) on the player’s humanoid, or wherever you add the tag.

oh ok i think that would help but i got rid of the tag now, since it wasnt working either when it got removed

Ex: players win, they receive a tag, then round resets, player tag was removed, but couldnt win again for some reason

The tag wasnt the issue, so i will revise my code but thank you for that tip though, which i think i already knew :cry:

Are you disconnecting the touch event before the round resets?

umm no… would i have to do that? I mean i read about it earlier but i wasnt sure if i needed that though :thinking:

As more resets happen this can turn into a memory breach, think of it those way, having 100 touch events activated on one part is definitely not good for server performance

You can disconnect by doing this (im on mobile so there is no backtick)

local RBXSignal = nil

RBXSignal : RBXScriptConnection = part.Touched:Connect(function(part)

—Print(part)

end)

— Round End Event —

RBXSignal:Disconnect()

and this is good for performace and memory leak related stuff right?

Also, does this mean that all i had to do was disconnect my touched even after the match ended and i wouldve had it fixed!!!??? :sob: :sad:

It prob would have fixed my issue, thanks for that tip though!