What do I want to achieve?
I want to learn how I would go about using AddAccessory, I saw a DevForum post related to not knowing how to make a gas mask that would prevent being damaged in a certain area after searching on youtube/ and the devforum for a brief explanation on how you would do this.
What is the issue? I don’t know how to script well, I have a basic understanding of how events and functions work and thats really all. What solutions have I tried so far? I looked at the “API reference” of AddAccessory, but I didn’t really understand it.
Basically, I just want a brief, basic explanation on how I would go about using AddAccessory for a gas mask and a radiation zone, not how to make the gas mask and radiation zone.
Hi I would consider that AddAccessory would just be for aesthetics only. When the player equipped the mask, I would add an attribute to confirm the mask Enabled status on the player:
player:SetAttribute("MaskOn", true)
Somewhere on your map, you would then have gas damage areas, hopefully defined as a region, which would then look for a character in that region. As you loop through each player every n’th seconds, you would check if the player is wearing a mask:
local isMasked = player:GetAttribute("MaskOn")
If isMasked is false, then apply your damage, if true, then you don’t. Have fun.