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

Unable to cast value to objects?

Asked by 9 years ago

When I use this script, I get this error:

15:07:18.573 - Unable to cast value to Objects 15:07:18.573 - Script 'Players.Player1.Backpack.Chem Sniper.LocalScript', Line 14 15:07:18.574 - Stack End

How do I fix it?

01local tool = script.Parent
02local user
03local IgnoreList = {"Handle", "Hat"}
04 
05 
06tool.Equipped:connect(function(mouse)
07 
08   user = tool.Parent
09 
10 
11   mouse.Button1Down:connect(function()
12 
13      local ray = Ray.new(tool.AimPart.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit*300)
14      local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, user)
15 
View all 47 lines...
0
Can you post the output error? ISellCows 2 — 9y
0
Posted. phoniex 0 — 9y
0
I haven't used FindPartOnRay before, but something you could try is replacing user on line 14 with a table of all the character's parts. ChipioIndustries 454 — 9y

Answer this question