You can write your topic however you want, but you need to answer these questions:
What do you want to achieve?
I want to shoot a raycast to the player’s mouse
What is the issue?
It looks as if it thinks the hit is a Vector3
What solutions have you tried so far?
I tried removing the .Position after the hit but it said Unit is not a valid member of CFrame
Here is my code
local function castRay(hit)
local orgin = script.Parent.Handle.Position
local Stop = (hit.Position - orgin).Unit * 500
local result = workspace:Raycast(orgin, Stop, params)
if result then
local target = result.Instance
if target.Parent then
local position = result.Position
return castRay(position)
end
end
end
script.Parent.Shoot.OnServerEvent:Connect(function(player, Hit)
local Attachment0 = Instance.new("Attachment")
Attachment0.Parent = Target
Attachment0.Position = castRay(Hit)
end
I am having the same exact error but I am not doing a raycast. But the error is: Position is not a valid member of Vector3 - Server - VerminScript:8. and here is my code:
while task.wait(0.1) do
if vermin.Position.Y <= 1.8 then
vermin.Position = vermin.Position + Vector3.new(0, .2, 0)
else
task.wait(.3)
vermin.Position = vermin.Position - Vector3.new(0, 2, 0)
local randPos = allPlots[math.random(1, #allPlots)].Position
vermin = randPos - Vector3.new(0, .807, 0)
end
end
I am taking this directly from a course video. And have tried to figure out how to put the instance explained above. I am not figuring that out since i am not targeting anything. I am just trying to compare the Y value in the Position of the Vermin to see if it is less than 1.8. Soon as this line is called I get that error. Also tried to put in the Vector3.new(0,1.8,0) but that wasn’t a way to compare the Y value either. I am hoping that since I am reviving this is the correct way to do it and not start a new topic since its the exact same error. I am pretty new maybe I am missing a period or colon on something. Thank you.