I’m owner of experience that is mostly made for photos or screenshots of avatars, and i think i a button that would make players invisible would fit perfectly and increase the experience quality.
The problem is that i really suck at scripting and have no idea how to script this button.
Basically i want the button to make players invisible for the player that clicked the button only. If there will be other players that didn’t clicked the button, then they won’t see the other players invisible. (Ask me any question if this was confusing. I will try to explain it better)
Sure just put this local script inside of your button
local invisible = script.Parent
invisible.MouseButton1Click:Connect(function()
for _, p in pairs(game.Players:GetPlayers()) do
local char = p.Character or p.CharacterAdded:Wait()
local root = char:FindFirstChild('HumanoidRootPart')
if char and root then
for _, part in pairs(p.Character:GetDescendants()) do
if part:IsA('Part') or part:IsA('MeshPart') then
part.Transparency = 1
end
end
end
end
end)
Hey, Thanks, there’s small problem, the script works, but it makes the player that clicked the button invisible too, and when i click the button again, the players won’t be visible again. They just stay invisible. But still thanks!
local invisible = script.Parent
local Players = game:GetService('Players')
local LocalPlayer = Players.LocalPlayer
local Boolean = false
invisible.MouseButton1Click:Connect(function()
for _, p in pairs(Players:GetPlayers()) do
local char = p.Character or p.CharacterAdded:Wait()
local root = char:FindFirstChild('HumanoidRootPart')
if char and root and Players:GetPlayerFromCharacter(char) ~= LocalPlayer and not Boolean then
Boolean = true
for _, part in pairs(p.Character:GetDescendants()) do
if part:IsA('Part') or part:IsA('MeshPart') then
part.Transparency = 1
end
end
elseif char and root and Players:GetPlayerFromCharacter(char) ~= LocalPlayer and Boolean then
Boolean = false
for _, part in pairs(p.Character:GetDescendants()) do
if part:IsA('Part') or part:IsA('MeshPart') then
part.Transparency = 0
end
end
end
end
end)
I wouldn’t be able to know where that block came from without seeing what spawned it inside of the player. You could try using the find all feature in Studio and type something like
This is most likely the HumanoidRootPart that is showing up. So you just need to check before setting Transparency back to 0
For Example:
if part:IsA('Part') or part:IsA('MeshPart') then
if part.Name ~= "HumanoidRootPart" then
part.Transparency = 0
end
end
Otherwise here’s the updated code:
local invisible = script.Parent
local Players = game:GetService('Players')
local LocalPlayer = Players.LocalPlayer
local Boolean = false
invisible.MouseButton1Click:Connect(function()
for _, p in pairs(Players:GetPlayers()) do
local char = p.Character or p.CharacterAdded:Wait()
local root = char:FindFirstChild('HumanoidRootPart')
if char and root and Players:GetPlayerFromCharacter(char) ~= LocalPlayer and not Boolean then
Boolean = true
for _, part in pairs(p.Character:GetDescendants()) do
if part:IsA('Part') or part:IsA('MeshPart') then
part.Transparency = 1
end
end
elseif char and root and Players:GetPlayerFromCharacter(char) ~= LocalPlayer and Boolean then
Boolean = false
for _, part in pairs(p.Character:GetDescendants()) do
if part:IsA('Part') or part:IsA('MeshPart') then
if part.Name ~= "HumanoidRootPart" then
part.Transparency = 0
end
end
end
end
end
end)