Hello! So recently I have started making a game which has fake hands in it. When I run the game, the hands are cloned from ServerStorage to the Workspace. From there, they go to the LocalPlayer. The reason for this is because I want to set the NetworkOwner to the Client for the model (There is a separate ServerScript doing this). Now, in my script, after the hands are cloned to the localplayer, I want to set the velocity for a part inside of the model (Called GrabSphere). For some reason, it is not detecting the part in the model and it returns nil. I already checked in the explorer and the part is in there. Anyone have any ideas?
the variable “Player” is defined by “Players.LocalPlayer”
the variable “Players” is defined by "game:GetService(“Players”)
script (LocalScript inside StarterPlayerScripts. This is not the entire script.):
I made sure the hands are in the LocalCharacter before the Velocity change is ran. Maybe this is happening because the script is in “StarterPlayerScripts”?
Oh, FindFirstChild can return nil and it won’t throw any error. Try doing ;
local LeftGrabSphere = LeftHand:FindFirstChild("GrabSphere")
local RightGrabSphere = RightHand:FindFirstChild("GrabSphere")
if LeftGrabSphere and RightGrabSphere ~= nil then
print("GrabSpheres Detected")
end
It shouldn’t print anything. And then, if it doesn’t print anything, try switching FindFirstChild to WaitForChild.
Yes they are being cloned into the LocalCharacter.
The code is getting stuck on the snippet you gave me.
It thinks it should be looking for an instance named “PrimaryPart”.
It returns with the message: “PrimaryPart is not a valid member of MeshPart” which I think is weird because I do not have any meshes in my game right now.
Also, im sorry for taking up your time with this. I am working a sandbox VR game and your help is very appreciated.
So, the problem is that LeftGrabd and RightGrab are nils, that’s it. I could probably help you fixing it but I’d need more context about how ur cloning the spheres.