✓ Accepted answer
dude, rather than putting it inside the local script inside the individual part, do it inside
StarterPlayer > StarterPlayerScripts
and here's the code with some brief explanation
local Player = script.Parent.Parent
local Character = Player.Character
if not Character ~= nil then
Character = Player.CharacterAdded:Wait()
end
local Humanoid = Character:WaitForChild("Humanoid")
local MasterControl = require(script.Parent:WaitForChild("ControlScript"):WaitForChild("MasterControl"))
local BodyParts = {
"Right Leg";
"Left Leg"
}
local ImmobilizeDuration = 3
local Immobilizer = function()
for _, Part in next, BodyParts do
Character[Part].Touched:Connect(function(Touched)
if Touched.Name == "disabler" and Humanoid:GetState() ~= Enum.HumanoidStateType.Dead then
MasterControl:Disable()
wait(ImmobilizeDuration)
MasterControl:Enable()
end
end)
end
end
Humanoid.Died:Connect(function()
Character = Player.CharacterAdded:Wait()
Humanoid = Character:WaitForChild("Humanoid")
Immobilizer()
end)
Immobilizer()
as you may notice, there has been some changes