This is my script:
--Teleport
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local char = player.Character
local visible = true
--Parts
local head = char.Head
local torso = char.Torso
local larm = char["Left Arm"]
local rarm = char["Right Arm"]
local lleg = char["Left Leg"]
local rleg = char["Right Leg"]
--Functions
function makeInvisible(object)
local objectChildren = object:GetChildren()
for i = 1,#objectChildren do
for v = 0,1,0.001 do
if objectChildren[i]:IsA("Part") then
objectChildren[i].Transparency = v
elseif(objectChildren[i]:IsA("Hat")) then
objectChildren[i].Handle.Transparency = v
end
end
end
end
function makeVisible(object)
local objectChildren = object:GetChildren()
for i = 1,#objectChildren do
for v = 1,0,0.001 do
if objectChildren[i]:IsA("Part") then
objectChildren[i].Transparency = v
elseif(objectChildren[i]:IsA("Hat")) then
objectChildren[i].Handle.Transparency = v
end
end
end
end
--
mouse.KeyDown:connect(function(key)
if key == "z" and visible == true then
makeInvisible(char)
visible = false
end
if key == "x" and visible == false then
visible = true
makeVisible(char)
end
end)
The object of the script is to make a character invisible when the key "z" is pressed. The character is supposed to become visible when the key "x" is pressed. Please explain what is wrong.

2 comments
Line 31, -0.001, not positive, if you're going from 1 to 0.
Oh your right