martearo
(Uncle_Dinero)
#1
So i want to get if the mouse’s target is a part or not, if it’s a part then i want a function to start.
The script works when i click and everything but as soon as i click in the sky / the air, the script breaks and can’t detect that the sky is a thing.
i have tried the Mouse.TargetFilter function but it doesn’t seem to do any different.
Code:
-- if Mouse.Target:IsA("Part") then
Error:
-- Players.martearo.Backpack.Item.LocalScript:24: attempt to index nil with 'IsA'
Any Help would be greatly appreciated
1 Like
xZylter
(xZylter)
#2
Add an additional check to make sure Mouse.Target ~= nil
.
8 Likes
if Mouse.Target.Parent == workspace and Mouse.Target:IsA("Part") then
1 Like
martearo
(Uncle_Dinero)
#4
i have tried that before but sadly it didn’t work too
1 Like
You can also shoot a ray to the mouse lookvector for a better input but thats your decision.
it just gives you more options to do with the hit position and normal!
2 Likes