I read this and it worked (Goulstem's Answer) https://scriptinghelpers.org/questions/17049/how-would-i-fix-click-detectors-if-filtering-is-enabled
However, this makes it so you can click at any distance. I was wondering how you would make it so once it was clicked in the distance 10, then the script would carry out its function instead of anywhere > 10
This is the script
local Plr = game.Players.LocalPlayer local mouse = Plr:GetMouse() local part = workspace.Note mouse.Button1Down:connect(function() local Que = script.Parent.Parent.Parent.Quest local targ = mouse.Target if targ == part then
No errors, just simply want to know if anyone else knows how to make it so this only functions from the distance less or equal to 10 ...thanks
Basically, you have to get player's position and distance between him and target. So first, take player's position (in this case i will take the position of player's head):
local pos = Plr.Character.Torso.Position
then take the distance between head and target and make the 'if' statement:
if (pos - targ.Position).magnitude <= 10 then