Ok, so I am working on a laser that shoot whenever you click.
However, it is giving me this error:
invalid argument #1 (Vector3 expected, got Instance)
local raycastResults = workspace:Raycast(player.Character.Head.Position, (mousePos - player.Character.Head.Position)*1000, raycastParams)
I got the player object from a local script using remote events.
v_kyuu
(moz)
#2
Is there any instance named Position in the Head?
I have checked and there appears to be no instance named “Position”
As he said, but if you’re too lazy to remove a instance named “Position” u can also try doing
player.Character.Head.CFrame.p
1 Like
but there’s no instance named position
Make sure the character is loaded before the raycast code runs. You can use player.Character:Wait()
to wait for a character.
And no, the player’s head position is not an Instance. It should be a Vector3 value.
I did what you told me but I got the same error
we were asking if he had an Instance named “Position” inside the head
where are you referring the raycastResults?
Check your remote event parameters and make sure the order is proper and the extra player parameter in the on server event is taken care of.
Similar to this issue:
2 Likes
Yes this worked, I put (player, mouse.Hit.p) instead of just (mouse.Hit.p)
1 Like