#Need help for simple Viewmodel with hands

1 messages · Page 1 of 1 (latest)

high swift
#

So i am new to this and i just wanna make some hands that holds a lantern, im following some tutorials but i cant get the viewmodel to work. The script is under StarterPlayerScript

mint hollyBOT
#

studio** You are now Level 1! **studio

high swift
#

I already changed the model to "ViewModel"

peak plaza
#

any errors?

high swift
peak plaza
#

try setting camera to workspace.CurrentCamera - it may be that the camera you are currently referencing is not the one currently being used.

high swift
elfin cobalt
#

rtruy

#

try

peak plaza
#

quick question - why would there be a humanoid in the camera?

high swift
rough valve
#

show the other model

high swift
high swift
peak plaza
#

no. the top line, it infers that a humanoid instance is inside of camera.

#

if there isn't then the condition is false and the position wont change.

high swift
rough valve
#

oh wait

#

nvm

#

lol

#

my dumb ahh didnt read everything

peak plaza
#

try removing that if statement entirely

high swift
peak plaza
#

that one only needs to run once, so you should move it to be above the renderStepped container

elfin cobalt
#

wait im gonna write it down

#

and gonna chop it one by one

#

do you need explation

#

or just the code

high swift
#

u can just write the code

mint hollyBOT
#

studio** You are now Level 2! **studio

high swift
#

ill understand it after

elfin cobalt
#

you may try this if it would work

#

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local camera = workspace.CurrentCamera
local RunService = game:GetService("RunService")

local viewModel = game.ReplicatedStorage:WaitForChild("ViewModel"):Clone()
viewModel.Name = "ViewModel"
viewModel.Parent = camera

for _, part in pairs(viewModel:GetChildren()) do
if part:IsA("BasePart") then
part.CanCollide = false
end
end

RunService.RenderStepped:Connect(function()
if not Player.Character or not Player.Character:FindFirstChild("Humanoid") then return end

local humanoid = Player.Character:FindFirstChild("Humanoid")

if humanoid.Health <= 0 then
    if camera:FindFirstChild("ViewModel") then
        camera.ViewModel:Destroy()
    end
    return
end

if camera:FindFirstChild("ViewModel") then
    camera.ViewModel:SetPrimaryPartCFrame(
        camera.CFrame * CFrame.new(0.025, -1.5, -1) * CFrame.Angles(0.5, 0, 0)
    )
end

end)

elfin cobalt
high swift
#

goofy ahh hands

elfin cobalt
high swift
elfin cobalt
elfin cobalt
high swift
high swift
elfin cobalt
#

wait

#

Structural issues

Runtime logic issues

Technical mistakes

high swift
elfin cobalt
#

You cloned the ViewModel but didn’t assign it a .Name, yet later tried to FindFirstChild("ViewModel")

#

The way the script checked for things (like camera:FindFirstChild("Humanoid")) shows confusion in object structure (camera is not equal to character).

high swift
elfin cobalt
#

Yes, if you're using camera:FindFirstChild("ViewModel") anywhere in your script.

high swift
elfin cobalt
#

it would like make it destroy the model

#

when the player is dead

#

if your game is not about pvp or the player will not die its okay to remvoe the humanoid

#

or any death related

high swift
#

okay i get it its not my viewmodel humanoid its calling its when i press play and my player humanoid

#

or am i tripping

high swift
elfin cobalt
#

you can get the humanoid from the localplayer cause the localplayer always have humanoid

elfin cobalt
elfin cobalt
high swift
high swift
elfin cobalt
high swift
mint hollyBOT
#

studio** You are now Level 3! **studio

high swift
#

why is it that i can see the shadows from the floor on my arms

elfin cobalt
high swift
tawny blade
#

I think you need to go to lighting service and turn off shadows

high swift
tawny blade
#

Global shadows

high swift
high swift
tawny blade
#

You have baseplaate material on

#

I think that’s the issue

#

It makes everything look like a grid

#

And darker

high swift
tawny blade
#

Go to home

#

It should be somewhere on there

high swift
high swift
tawny blade
#

Wait nvm I think it’s on model

mint hollyBOT
#

studio** You are now Level 1! **studio

high swift
tawny blade
#

No.. how about view

high swift
high swift