How to make player invisible when using sniper scope?

Hey i want my sniper scope to look amazing but the thing is, it doesn’t completely work rn it looks like this


Anyone knows how to fix it and make it so you can’t see yourself?
My script also looks like this:

UserInputService.InputBegan:Connect(function(Input, gameProcessedEvent)
	if Input.KeyCode == Enum.KeyCode.Q and script.Parent.Parent == Player.Character then
		Zooming = true
		Camera.FieldOfView = 10
		Player.Character.Humanoid.WalkSpeed = 10
		Camera.CameraSubject = script.Parent.Scope
		Camera.CameraType = "Custom"
		Camera.CFrame = script.Parent.Scope.CFrame
		Player.CameraMode = Enum.CameraMode.LockFirstPerson
		--[[RunService.Heartbeat:Connect(function()
			if Zooming == true then
				Camera.CameraType = Enum.CameraType.Scriptable
				Camera.CFrame = script.Parent.Scope.CFrame
				
			end
		end)--]]
	end
end)

UserInputService.InputEnded:Connect(function(Input, gameProcessedEvent)
	if Input.KeyCode == Enum.KeyCode.Q and script.Parent.Parent == Player.Character or Input.KeyCode == Enum.KeyCode.Q and Camera.FieldOfView == 10 then
		Zooming = false
		Camera.FieldOfView = 70 
		Player.Character.Humanoid.WalkSpeed = 16
		Camera.CameraSubject = Player.Character.Humanoid
		Camera.CameraType = "Custom"
		Camera.CFrame = Player.Character.Head.CFrame
		Player.CameraMode = Enum.CameraMode.Classic
	end 
end)
1 Like
for i,v in pairs(Player.Character:GetChildren()) do
    if v:IsA("BasePart") then
        v.Transparency = 1
    end
end

Should do the trick.

As @Puzzled3d said, maybe you can add a remote event that will fire when they use the sniper scope and then in a local script when the remote fire will run change the transparency of all the body parts of the player that sent the remote event to 1

No need for a remote event. It seems like it is already in a local script + remote events can be exploited to make people invisible.

Oh, I didn’t noticed that, thanks.

problem is that i can still see my beard and accesorry’s and stuff like that
I think i know how to fix it so don’t worry

GetDescendants() instead of GetChildren() but for a more performant approach you should do the following.

local function makeInvisibleRecursive(object)
	for _, instance in ipairs(object:GetChildren()) do
		if instance:IsA("BasePart") then
			instance.Transparency = 1
		elseif instance:IsA("Accessory") then
			makeInvisibleRecursive(instance)
		end
	end
end

and if you want to include the character’s tool too.

local function makeInvisibleRecursive(object)
	for _, instance in ipairs(object:GetChildren()) do
		if instance:IsA("BasePart") then
			instance.Transparency = 1
		elseif instance:IsA("Accessory") then
			makeInvisibleRecursive(instance)
		elseif instance:IsA("Tool") then
			makeInvisibleRecursive(instance)
		end
	end
end