Hello! Im currently having an issue with my coded, it gives an error if I just give the code the models path, it gives and error for FindFirstChild, infinite yeild on WaitForChild() - im not sure what to do
attempt to index nil with ‘FindFirstChild’
MouseEvent.OnServerEvent:Connect(function (clientThatFired, viewmodel, mousePoint)
FirePointObject = viewmodel:FindFirstChild("GunModel").Barrel.Muzzle
This means that viewmodel is nil. Are you sure you passed the arguments correctly and that viewmodel exists on the server?
The viewmodel is cloned on the client-side so that the client can see it, then its passed through this event, could the fact that its all cloned on the client side have something to do with it?
If it’s made client side and you try ot pass it to the server, the server doesn’t know what you’re trying to send so will nil. You need to pass the required stuff yourself instead of sending in the viewmodel directly, what are you planning on using the viewmodel for in the server?
1 Like
Im not sure what I would need to pass for it to work correctly by what you said, and im using the viewmodel on the server side so that the bullet comes out the barrel
Can’t you pass in the position of the barrel then instead of the viewmodel?
The point where it fires from is an attachment inside the client-side viewmodel, it cant find said attachment and just prints nil
I meant as, can’t you pass in the position of the attachment in the fireserver instead of the viewmodel?
MouseEvent:FireServer(Attachment.Position, mouse.Hit.p)
1 Like
I dont know why I didnt think of this, this works perfectly
1 Like