I want to change "damage" if player is wearing an accessory. No idea how to check if player is wearing accessory but tried this.
local Player = game.Players.LocalPlayer repeat wait() until Player.Character~= nil local Char = Player.Character if Char:FindFirstChild("MagicTopHat")~= nil then damage = damage * 50 end
This is a localscript inserted into starterpack.
Any help would be appreciated. Thanks :D
Every accesory have a unique mesh and the mesh has a unique ID. You can check if the mesh is using a certain ID and that's how you figure out what accessory it is. You can also do this for shirts, pants, and T-shirts.
Char = game:GetService("Players").LocalPlayer damage = 10 if Char:FindFirstChild("MagicTopHat") then if Char.MagicTopHat:FindFirstChild("Handle") then if Char.MagicTopHat.Handle:FindFirstChild("Mesh") then if Char.MagicTopHat.Handle.MeshId == "" then -- insert mesh Id here damage = damage * 50 end end end end
I went to make sure that it could find the accessory's handle and mesh in case it was renamed or so. The default name for a Accessory's part is always Handle
.