This is an invisibility keybind script you can hold down and it works on my screen but when I was testing and checked the player 2 screen I was still visible. Is there any way I can change it so its invisible on someone else's screen and not visible?
--[[ Varaibles ]]-- local uis=game:GetService("UserInputService"); --[[ Main ]]-- -- pressing uis.InputBegan:connect(function(input) if input.KeyCode==Enum.KeyCode.E then print("pressing the key E"); local TS = game:GetService("TweenService") local Info = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out) for _, v in pairs(script.Parent:GetDescendants()) do if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" and v.Name ~= "LeftFoot" and v.Name ~= "RightFoot" and v.Name ~= "RightLowerLeg" and v.Name ~= "LeftLowerLeg" then TS:Create(v, Info, {Transparency=0.9}):Play() end end end end) -- left uis.InputEnded:connect(function(input) if input.KeyCode==Enum.KeyCode.E then print("you have stopped"); local TS = game:GetService("TweenService") local Info = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out) for _, v in pairs(script.Parent:GetDescendants()) do if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" and v.Name ~= "LeftFoot" and v.Name ~= "RightFoot" and v.Name ~= "RightLowerLeg" and v.Name ~= "LeftLowerLeg" then TS:Create(v, Info, {Transparency=0}):Play() end end end end)
The Transparency is changed client sided so only the client can see the new Transparency. You need to change the Transparency on a server script so other players can see the new Transparency. You can do this with a remote event.
Create a remote event named invisible parented to ReplicatedStorage
--[[ Varaibles ]]-- local uis=game:GetService("UserInputService"); --[[ Main ]]-- -- pressing uis.InputBegan:connect(function(input) if input.KeyCode==Enum.KeyCode.E then game.ReplicatedStorage.invisible:FireServer("Began", script) end end) -- left uis.InputEnded:connect(function(input) if input.KeyCode==Enum.KeyCode.E then game.ReplicatedStorage.invisible:FireServer("Ended", script) end end)
Create a new script in ServerScriptService
game.ReplicatedStorage.invisible.OnServerEvent:Connect(function(plr, var, LocalScript) local TS = game:GetService("TweenService") local Info = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out) for _, v in pairs(LocalScript.Parent:GetDescendants()) do if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" and v.Name ~= "LeftFoot" and v.Name ~= "RightFoot" and v.Name ~= "RightLowerLeg" and v.Name ~= "LeftLowerLeg" then if var == "Began" then TS:Create(v, Info, {Transparency=0.9}):Play() elseif var == "Ended" then TS:Create(v, Info, {Transparency=0}):Play() end end end end