First Person Mode Help

How would I stop this happening? https://gyazo.com/a1201b4be33ee74982c52c8455bd3725
(AKA when zoomed into first person mode, the skis do not disappear.)

2 Likes

Suggested Method


In order to prevent the skis from disappearing, you will need to create a ViewModel through LocalScript, which is exactly on the same position as the existing parts welded to the skis. Make sure these parts are massless.

This practice exists with FPS games where the arms are just a view model visible from the client only. Phantom Forces is one example using that.

The ViewModel will toggle transparency depending on zoom? Maybe. Not sure.

Alright, how would I do that? I’m not a very well experienced scripter, so could you possibly guide me through on how to do it?

Hmmm. I have to assume that you have the tool and the camera.

-- LocalScript - Client Script
local Camera = workspace.Camera

Camera:GetPropertyChangedSignal("CameraSubject"):Wait() -- avoiding early errors
Camera:GetPropertyChangedSignal("CFrame"):Connect(function() -- rough function, I can't find the player's zoom
	if (Camera.CFrame.p - Camera.CameraSubject.Parent.PrimaryPart.Position).Magnitude >= 2.1 then
		-- transparency is off
		print("HAHA")
	else
		-- transparency is on
		print("NOOO")
	end
end)

Honestly, I’m not experienced with manipulating the camera object yet, I have to test this. Script has been updated, tested in StarterPlayerScripts.

The view model is probably placed in ReplicatedStorage which you clone and place into the tool.

1 Like

Your question is confusing, but I’m going to assume that what you asked had to do with retaining the transparency of the skis in first person.

You’re going to have to bind a function to RenderStep that uses a RenderPriority value higher than the character (the one that the CameraModule uses to make first person models transparent) that sets the LocalTransparencyModifier of the objects to 0. This will prevent them from disappearing in first person.

local RunService = game:GetService("RunService")

RunService:BindToRenderStep("SkiVisibility", Enum.RenderPriority.Character.Value - 5, function()
    -- Set the LocalTransparencyModifier of the parts to 0.
    -- Example if the LocalScript is in the tool:
    local Tool = script.Parent

    for _, descendant in pairs(Tool:GetDescendants()) do
        if descendant:IsA("BasePart") then
            descendant.LocalTransparencyModifier = 0
        end
    end
end)

Make sure to unbind the function in cases where the skis are no longer used (i.e. when the skis are unequipped or in any way are no longer in use by the player).

4 Likes

I believe they mean to make the skies invisible when they zoom in:

when zoomed into first person mode, the skis do not disappear

So, use:

descendant.LocalTransparencyModifier = 1

cc @Hadiisepic

1 Like

The skis are invisible in the Gif already, so if that was the case, OP would have no point asking this question. I’m almost certain what they meant was retaining the ability to keep skis visible in first person, nor the other way around. Even if it was to keep the skis invisible,

  • As I already said, the skis are already invisible in first person

  • The CameraModule handles this automatically

Well, hopefully @Hadiisepic can clarify. The wording of this post is not the best and not very detailed, so I am unsure.

When zooming in, the children of the local player turns invisible. How to prevent this? Well, you can’t. The only work-around this is what @colbert2677 said.

Also, there is a past article on ScriptingHelpers, made 4 years ago, that answers this. (https://scriptinghelpers.org/questions/16508/how-to-prevent-tool-from-becoming-transparent)

So what’s happening is (I assume at least) that those skis are in the character model. Now, for better or worse, all parts within the character model go invisible when zoomed into 1p. It looks like people already posted some great solutions, and I’d personally recommend using ViewportFrames to create a ViewModel; sort of like what @Operatik suggested.

1 Like

I’ve never heard of using a ViewportModel as a ViewModel and I’m not sure why you’d want to do that either. Typically a ViewModel is constructed from a client model that’s attached in some manner to the camera or the character.

In this case, you can just override the LocalTransparencyModifier from the CameraModule and you’re done. Unless OP intends to make a ViewModel, there’s really no need to jump to other solutions when one is already readily available.

2 Likes

Yeah, ViewportFrames seem like an over-complication in this sense. Code is all about abstraction, and I think overriding the LocalTransparencyModifier is the best and most effective way of coming about this.

1 Like

Yes, that’s correct. It was to do with the transparency of the skis when zoomed in.