How to make mesh stay inside a part

local RunService = game:GetService("RunService")
local viewmodel = game.ReplicatedStorage.ViewModel:Clone()
local flashlight = game.ReplicatedStorage.Flashlight:Clone()

viewmodel.Parent = workspace.Camera
flashlight.Parent = workspace.Camera.ViewModel.RightArm.Handle

local camera = workspace.CurrentCamera


RunService.RenderStepped:Connect(function()
	viewmodel.Camera.CFrame = camera.CFrame
end)

I am currently making a viewmodel script and I want it so everytime the viewmodel is activated, the flashlight parent is the handle i’ve set up in the arm. I also want the flashlight to always face the front no matter the rotation. Sorry if am not very good at explaining but an example of this is the Evade’s flashlight viewmodel.

Here is where the handle is setup. Please let me know if there is any better way to do this, Thank you!

2 Likes

I have decided to manually add items for each animation. I’ve seen a lot of tutorials do this but is this efficient or is this just how viewmodel is suppose to go?

1 Like

bump
plz help me am new to roblox studio