So basically i’m making a button that makes your entire character forcefield.
But what’s happening is that only 1 bodyPart gets forcefield every 5 seconds.
I want it to make every single one of them forcefield instantly.
-- Services
local RS = game:GetService("ReplicatedStorage")
------------------------------------------
-- Variables
local Remote = RS:WaitForChild("ToggleSkill")
local SkillDuration = 5
------------------------------------------
Remote.OnServerEvent:Connect(function(player)
local character = player.Character
local function TurnSkillOn(material, oldMaterial)
for i, bodyPart in pairs(character:GetDescendants()) do
if bodyPart:IsA("BasePart") or bodyPart:IsA("Part") or bodyPart:IsA("MeshPart") then
bodyPart.Material = material
wait(SkillDuration)
bodyPart.Material = oldMaterial
end
end
end
TurnSkillOn("ForceField", "Plastic")
end)