I want to achieve a veiwmodel similar to something like combat initiaion where your view model arms is just your characters arms that rotate with your camera. The veiwmodel should also sync with tools and animations
I just want to sollution on how to do this, I don’t want someone to script the whole thing for me
(The arms sync with the actual player model and tools show for the view model)
Roblox hides the player’s body parts whenever the camera is fully zoomed in using a property called LocalTransparencyModifier. If you set this to 0, on a body part, it will show the body part. So for both arms, continuously set this property to 0.
Impl
local UserInputService = game:GetService "UserInputService"
local Players = game:GetService "Players"
local Player = Players.LocalPlayer
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
Player.CharacterAdded:Connect(function(char : Model)
for _, part in ipairs(char:GetChildren()) do
if not part:IsA "BasePart" or (part.Name ~= "LeftArm" and part.Name ~= "RightArm") then continue end
part.LocalTransparencyModifier = 0
part:GetPropertyChangedSignal "LocalTransparencyModifier" : Connect(function()
part.LocalTransparencyModifier = 0
end)
end
end)
no offense but missing parenthesis is not a good practice, it causes ambiguity since you only can use this syntax on single argument functions, and it just confuses people a little more
you shouldnt make LocalTransparencyModifier equal to Transparency, if transparency is 0.5 and modifier is 0.5 then observable transparency becomes 0.25
There is a community resource that does exactly what you want to do, maybe even more than you even want it to do. Works in R6 & R15 and is very easy to configure settings for your viewmodel. Just get the asset from the creator store and you’re all set. Don’t know if there is any better ones out there but this is definately fit for your intended use. Here is the DevForum post for it: EasyFirstPerson: Drag-and-drop first person view models!
If you want to make your own, there are plenty of tutorials on the Devforum and YouTube!
It’s by cloning existing viewmodel! after having them cloned and parented to camera, re-position them to face the camera every frame and now you have a universal viewmodel, you can use R6 and remove every single unnecessary parts but in combat initiation, it manipulates Motor6D which works but stutters, you can view it’s source code from here
they don’t really move yet, since you have Motor6D in that viewmodel, if it’s relatively the same build from 3rd perspective character, you can use Transform and it’ll move according to how you see in 3rd person view, tool however won’t rlly move to your viewmodel if entered, you’ll have to detect whenever there is a tool inside the character then have another weld or Motor6D attached to viewmodel.
I meant that for functions its not that great, since when you get to multiple arguments that syntax is invalid for lua, even if it was it would be rather annoying that a syntax candy.