I am trying to make a part on when touched by a humanoid, it then starts to disintegrate the limbs and then kill the player. But there is a value inside the embalming part, which when set to 0, it is off, but 1, it is on. How can I achieve this? Here are my current scripts.
Embalming script
local embalm = script.Parent
local control = script.Parent.Parent.Control
local on = control.Buttons.on
local off = control.Buttons.off
local Touched = embalm.Touched.Parent:GetChildren()
local value = script.Parent.On.Value
embalm.Touched:connect(function()
if value == 1 then
for i = 100,0,1 do
Touched.Parent.Humanoid.Health = -1
Touched.Transparency = -.1
wait(0.1)
end
elseif value == 0 then
end
end)
On/Off script
Off
local value = script.Parent.Parent.Parent.Parent.embalm.On.Value
script.Parent.MouseButton1Click:connect(function()
if value == 1 then
value = 0
elseif value == 0 then
end
end)
On
local value = script.Parent.Parent.Parent.Parent.embalm.On.Value
script.Parent.MouseButton1Click:connect(function()
if value == 0 then
value = 1
elseif value == 1 then
end
end)

3 comments
Is |script.Parent.On.Value| a boolvalue or something else?
NumberValue
You did your for loop backwards (for i = 100,0,1 >>> for i = 0,100,1)