#Need help for simple Viewmodel with hands
1 messages · Page 1 of 1 (latest)
** You are now Level 1! **
I already changed the model to "ViewModel"
any errors?
the viewmodel is stuck on the ground and doesnt follow the player
try setting camera to workspace.CurrentCamera - it may be that the camera you are currently referencing is not the one currently being used.
tried to change it to what local camera = workspace.CurrentCamera doesnt seem to work
quick question - why would there be a humanoid in the camera?
goofy ahh hands
lol
i have another model but i just wanted to test something quick
show the other model
do u mean the humanoidrootpart
try it on
i tried that it didnt work
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.
Ah i see what u mean do i need to change it to the camerabone then
btw u wrote : ```lua
if Camera:FindFirstChild("ViewModel") ~= nil then
you could just say : ```lua
if Camera:FindFirstChild("ViewModel") then
oh wait
nvm
lol
my dumb ahh didnt read everything
try removing that if statement entirely
i removed the if statement what about the for statement
that one only needs to run once, so you should move it to be above the renderStepped container
just delete it all
wait im gonna write it down
and gonna chop it one by one
do you need explation
or just the code
u can just write the code
** You are now Level 2! **
ill understand it after
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)
it worked
show it
put it on first person
How do i do that
go to starrterplayer
Cameramode then make it lockonfirstperson
can u explain what the difference was between ur code and the one i wrote
where do u get that from
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).
Do i have to give the model a new name, i get that thing about the humanoid that i dont even have that
Yes, if you're using camera:FindFirstChild("ViewModel") anywhere in your script.
in teh code u send me, why are we using this line local humanoid = Player.Character:FindFirstChild("Humanoid") when there is no humanoid
If you're only attaching hands/arms to the camera and not monitoring death
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
okay i get it its not my viewmodel humanoid its calling its when i press play and my player humanoid
or am i tripping
i just wanna make sure i understand where the system finds "Humanoid" from, because i ahvent made a humanoid
you can get the humanoid from the localplayer cause the localplayer always have humanoid
in here right?
in the workspace
thats after u pressed play right?
i see it thanks for your help i appreciate it a lot
yeah
one more question
** You are now Level 3! **
why is it that i can see the shadows from the floor on my arms
because, i think theres cast sahdow on it
i took it off on everything my arms and the lantern but its still there
I think you need to go to lighting service and turn off shadows
something in here myabe?
Global shadows
still doesnt work 😦
its weird becuse i dont see other poeple with this problem
You have baseplaate material on
I think that’s the issue
It makes everything look like a grid
And darker
how do i remove it
the material one?
Wait nvm I think it’s on model
** You are now Level 1! **
somewhere in here?
No.. how about view
oh yes it was in view and i had grid material on
life saver ❤️