Fall Guys Type Thing Script not working

Trying to make a fall guys type thing with parts in a folder and the script produces this error.

local RandomPart = script.Parent.Lv2St3:GetChildren()

RandomPart.Touched:Connect(function(hit)
	local part = RandomPart.Touched
	local function NewTran(Number)
		part.Transparency = Number
	end
	part.CanCollide = false
	NewTran(0.2)
	wait(1)
	NewTran(0.5)
	wait(1)
	NewTran(1)
	wait(1)
	part.CanCollide = true
	NewTran(0)
end)

Also something I don’t understand even though I made the script.

What does this exactly do?

Like why the hit?

Is it a Parameter?

local partsFolder = --! Location

for Index, Item in pairs (partsFolder:GetChildren()) do
	Item.Touched:Connect(function()
		--> Your code here.
	end)
end
1 Like

function(hit) is what hit the Part, like if I touch the part, I’d be any of my Character parts.

1 Like

:GetChildren() returns an array of parts. You can’t call .Touched on an array. You would have to loop through the table and call the event on v.

2 Likes

I’d recommend you look into tweens so that the transparency portion is a lot more smoother. Secondly, you should check to see if the part is the player so that you know it’s 100% the player. You can do so by using the following function:

game.Players:GetPlayerFromCharacter(touched.Parent)

1 Like

I got an error

local partsFolder = script.Parent.Lv2St3

    for Index, Item in pairs (partsFolder:GetChildren()) do
	Item.Touched:Connect(function()
		local part = Item.Touched
		local function NewTran(Number)
			part.Transparency = Number
		end
		part.CanCollide = false
		NewTran(0.2)
		wait(1)
		NewTran(0.5)
		wait(1)
		NewTran(1)
		wait(1)
		part.CanCollide = true
		NewTran(0)
	end)
end

You can tween Transparency? I thought you could only tween size and position…

local RandomPart = script.Parent.Lv2St3:GetChildren()
for i, v in pairs(RandomPart) do
	v.Touched:Connect(function(hit)
		local function NewTran(Number)
			v.Transparency = Number
		end
		v.CanCollide = false
		NewTran(0.2)
		wait(1)
		NewTran(0.5)
		wait(1)
		NewTran(1)
		wait(1)
		v.CanCollide = true
		NewTran(0)
	end)
end

Is this what you are trying to do?

local partsFolder = script.Parent.Lv2St3
local tweenService = game:GetService("TweenService")

local function returnTween(transparency)
	local a = TweenInfo.new(
		3
	)
	local b = tweenService:Create(v, a, {Transparency = transparency})
	return b
end

for i, v in pairs(partsFolder:GetChildren()) do
	v.Touched:Connect(function()
		v.CanCollide = false
		local b = returnTween(1)
		b:Play()
		b.Completed:Wait()
		wait(1)
		b.CanCollide = true
		v.Transparency = 1
	end)
end
1 Like

no.
if he add onto there then eventually it will look like my old spaghetti code
i personally prefer to have a bunch of functions instead of one long string of code
also it is not required to fill out all the arguments in tweeninfo

also u missed the ‘e’ in CanCollide