So i have a game were your in a lobby and you can only see yourself. I made it so your not invisible but all the other players are. So to a players eye they only see there own character. But i have a text button "Play" so when they press that button they are supposed to fight each other.. the thing is they are invisible accept for them self's how to i make it when they press that text button it undos the invisible script.
while wait(1) do
local hide = true
local orignalTransparency = {}
local function checkPart(part)
for a,b in pairs(part:GetChildren()) do
checkPart(b)
end
if part:IsA("BasePart") or part:IsA("Decal") then
if hide then
if not orignalTransparency[part] then
orignalTransparency[part] = part.Transparency
end
part.Transparency = 1
else
if orignalTransparency[part] then
part.Transparency = orignalTransparency[part]
orignalTransparency[part] = nil
end
end
end
end
local players = game:GetService("Players")
local localPlayer = players.LocalPlayer
game:GetService("RunService").RenderStepped:Connect(function()
for i,v in pairs(players:GetPlayers()) do
if v ~= localPlayer then
local char = v.Character
if char then
checkPart(char)
char:WaitForChild("Head").OverHead.Enabled = false
end
end
end
for part,trans in pairs(orignalTransparency) do
if not part then
orignalTransparency[part] = nil
elseif not part.Parent then
orignalTransparency[part] = nil
end
end
end)
while true do
hide = true
wait(2.5)
end
end

2 comments
but how would the script work then if its always disabled?
oh yeah i forgot the script is in startergui so i made it so you can only see yourself. Because i have a lobby with cam manipulation. I also have a text button "Play" so when a player presses it it will stop the "HidePlayer" script and when they are in the lobby the script will run again