✓ Accepted answer
Yes, you will, however, also need a RemoteEvent to make the changes on the server, so other players can see it.
LocalScript in Tool
local localplayer = game.Players.LocalPlayer
local character = localplayer.Character or localplayer.CharacterAdded:wait()
local TransparencyEvent = script:WaitForChild('TransparencyEvent')
local Tool = script.Parent
local WhiteList = {
['Part1'] = true;
['Part2'] = true
}
local Parts = {}
local function PreCheck(Object)
if Object:IsA("BasePart") or Object:IsA('MeshPart') then
if Object ~= character.PrimaryPart and WhiteList[Object.Name] then
table.insert(Parts, Object)
end
end
end
for _, Object in pairs ( character:GetDescendants() ) do
PreCheck(Object)
end
Tool.Equipped:Connect(function()
TransparencyEvent:FireServer(Parts, 1)
end)
Tool.Unequipped:Connect(function()
wait()
if not character:FindFirstChildOfClass('Tool') then
TransparencyEvent:FireServer(Parts, 0)
end
end)
character.DescendantAdded:Connect(PreCheck)
Script inside of LocalScript
local TransparencyEvent = Instance.new("RemoteEvent")
TransparencyEvent.Name = 'TransparencyEvent'
TransparencyEvent.OnServerEvent:Connect(function(Player, Parts, newTransparency)
for i,v in pairs ( Parts ) do
v.Transparency = newTransparency
end
end)
TransparencyEvent.Parent = script.Parent
1 comment
Make a hat remover and put it inside of a tool and make it big enough to cover the player so their hat goes away? Make sure the part is cannot collide.