Hey everyone! So today I wanted to make a stage where when people step on a plank, it goes invisible so they have to be quick when they are jumping. I wanted to do it all in one script, I made a table and made the script. But I got an error saying Argument 3 missing or nil. Not really sure how to fix this. I know what the error means, I just don’t really know how to fix this. Here is my script. (Please judge my code, I need it lol, if anyone knows anyways of how to make my code not 100 lines, that would be great!)
-- Service
local TweenService = game:GetService("TweenService")
-- Variables
local PlanksTable = {
p1 = workspace.PlanksFall.Plank1;
p2 = workspace.PlanksFall.Plank2;
p3 = workspace.PlanksFall.Plank3;
p4 = workspace.PlanksFall.Plank4
}
local info = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)
local debounce = true
function Doinv1()
for i = 0,0.25,1 do
PlanksTable.p1.Transparency = i
end
end
function Doinv2()
for i = 0,0.25,1 do
PlanksTable.p2.Transparency = i
end
end
function Doinv3()
for i = 0,0.25,1 do
PlanksTable.p3.Transparency = i
end
end
function Doinv4()
for i = 0,0.25,1 do
PlanksTable.p4.Transparency = i
end
end
function uninv1()
for i = 1,0.25,0 do
PlanksTable.p1.Transparency = i
end
end
function uninv2()
for i = 1,0.25,0 do
PlanksTable.p1.Transparency = i
end
end
function uninv3()
for i = 1,0.25,0 do
PlanksTable.p1.Transparency = i
end
end
function uninv4()
for i = 1,0.25,0 do
PlanksTable.p1.Transparency = i
end
end
local tween1 = TweenService:Create(PlanksTable.p1,info,Doinv1())
local Tween1 = TweenService:Create(PlanksTable.p1,info,uninv1())
local tween2 = TweenService:Create(PlanksTable.p2,info,Doinv2())
local Tween2 = TweenService:Create(PlanksTable.p2,info,uninv2())
local tween3 = TweenService:Create(PlanksTable.p3,info,Doinv3())
local Tween3 = TweenService:Create(PlanksTable.p3,info,uninv3())
local tween4 = TweenService:Create(PlanksTable.p4,info,Doinv4())
local Tween4 = TweenService:Create(PlanksTable.p4,info,uninv4())
PlanksTable.p1.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if debounce then
debounce = false
end
tween1:Play()
wait(2)
Tween1:Play()
end
debounce = true
end)
PlanksTable.p1.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if debounce then
debounce = false
end
tween2:Play()
wait(2)
Tween2:Play()
end
debounce = true
end)
PlanksTable.p1.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if debounce then
debounce = false
end
tween3:Play()
wait(2)
Tween3:Play()
end
debounce = true
end)
PlanksTable.p1.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if debounce then
debounce = false
end
tween4:Play()
wait(2)
Tween4:Play()
end
debounce = true
end)
If anyone knows how to fix this, please tell me. I used a function to test things out and see if I could use it in a tween.