Why does this script make my player's legs invisible instead of the part itself?

Title says all, here’s the script that goes inside of the part I want to be invisible:

local gravel = script.Parent

local function PlayerTouched(gravel)
	gravel.Transparency = 0.1
	wait(0.2)
	gravel.Transparency = 0.3
	wait(0.2)
	gravel.Transparency = 0.5
	wait(0.2)
	gravel.Transparency = 0.7
	wait(0.2)
	gravel.Transparency = 1
end

gravel.Touched:connect(PlayerTouched)
1 Like

Because you defined gravel twice, try this

local gravesl = script.Parent

local function PlayerTouched(gravel)
	gravel.Transparency = 0.1
	wait(0.2)
	gravel.Transparency = 0.3
	wait(0.2)
	gravel.Transparency = 0.5
	wait(0.2)
	gravel.Transparency = 0.7
	wait(0.2)
	gravel.Transparency = 1
end

gravesl.Touched:connect(PlayerTouched)
1 Like

try this

local gravel = script.Parent

local function PlayerTouched()
	gravel.Transparency = 0.1
	wait(0.2)
	gravel.Transparency = 0.3
	wait(0.2)
	gravel.Transparency = 0.5
	wait(0.2)
	gravel.Transparency = 0.7
	wait(0.2)
	gravel.Transparency = 1
end

gravel.Touched:connect(PlayerTouched)

basically remove the parameter because that looks out for the part that touched it

3 Likes

That fixed the problem, thanks for your help!