Viewmodel completely deleted from player once game loads

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I need help on fixing my viewmodel.

  2. What is the issue? Include screenshots / videos if possible!
    Viewmodel completely deleting from the player when game fully loads (~ 3 seconds later)

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    tried changing the scripts, the viewmodel and welds
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- this is my main viewmodel script. I used a tutorial to help me make it since it is my first time making.

local RATE_PER_SECOND = 0
local RunService = game:GetService("RunService")
RunService.RenderStepped:Connect(function(step)
	local increment = RATE_PER_SECOND * step
	script.Parent:WaitForChild("HumanoidRootPart").CFrame = game.Workspace.CurrentCamera.CFrame
end)
RunService.RenderStepped:Connect(function(step)
	local increment = RATE_PER_SECOND * step
	for index, instance in pairs(script.Parent:GetDescendants()) do 
		if instance:IsA("BasePart") then
			instance.LocalTransparencyModifier = 0
		end
	end
end)


1 Like

Go in the Explorer to StarterPlayer in the properties CameraMode and set that to LockFirstPerson

this script should do the same, put this in StarterPlayerScripts.
make sure you set the viewmodels PrimaryPart to the HumanoidRootPart and put the viewmodel in ReplicatedStorage

local RATE_PER_SECOND = 0

local ReplicatedStorage = game:GetService("ReplicatedStorage") -- getting replicated storage
local RunService = game:GetService("RunService") -- getting runsservice
local Camera = workspace.CurrentCamera

local Viewmodel = ReplicatedStorage.Viewmodel:Clone() -- make sure you put your viewmodel in ReplicatedStorage

RunService.RenderStepped:Connect(function(step)
	local increment = RATE_PER_SECOND * step
	
	Viewmodel:SetPrimaryPartCFrame(Camera.CFrame) --Make sure you set your viewmodel PrimaryPart to HumanoidRootPart
	Viewmodel.Parent = Camera -- parenting the viewmodel to the camera
	
	for i, instance in pairs(Viewmodel:GetDescendants()) do -- loops through the viewmodel descendants
		if instance:IsA("BasePart") then -- check if instance is a basepart
			instance.LocalTransparencyModifier = 0
		end
	end
end)

I know your script isn’t the problem. The camera is default, but if you do LockFirstPerson then your camera is at the height of your Character Head

fixed the problem by cloning the viewmodel and making it run if the name is correct. sorry guys!

i ended up changing the script serverside instead of clientside to replicate it on the server aswell, but now when i do this and clone the viewmodel from replicatedstorage i get the same problem again. Could you help me?

fixed the problem. If anyone else has this problem, the fix is to anchor the mainpart of the viewmodel.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.