Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

un able to cast value to objects ray casting, issue?

Asked by 4 years ago

not sure whats going on here wached a video, and did everything he did but seems, to not work I had it working, the first time but when I went to save studio crashed and didn't save,


local ray = Ray.new(script.Parent.Position,Vector3.new(0,100,0)) while wait(1) do local hit,position = workspace:FindPartOnRayWithIgnoreList(ray,(script.Parent)) if hit then print(hit.Name) local p = Instance.new("Part",workspace) p.Anchored = true p.CFrame = CFrame.new(position) p.Size = Vector3.new(1,1,1) game:GetService("Debris"):AddItem(p,1) end end

1 answer

Log in to vote
0
Answered by
megukoo 877 Moderation Voter
4 years ago

Your error is when defining the ignore list for your raycast.

The method takes an array of objects to be ignored, and you provided it with a single object.

You'll need to change

workspace:FindPartOnRayWithIgnoreList(ray,(script.Parent))

to

workspace:FindPartOnRayWithIgnoreList(ray, {script.Parent})

Hopefully this works for you!

0
thank you! i see what i did there, a simple error. that can cause everything to fail. thats alot waterisice! BinarySolo 7 — 4y
0
Thank you! I didn't realize all I had to do was provide a table. HeatedWafflez 0 — 3y
Ad

Answer this question