This is supposed to print something when the player is hovering over a certain item and within 10 studs and it definitely does print but it does not matter how far the player is for some reason.
local m = require(workspace:WaitForChild("Modules"):WaitForChild("MainModule"))
local RunService = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local char = workspace:WaitForChild(player.Name)
local Mouse = player:GetMouse()
RunService.RenderStepped:Connect(function()
local target = Mouse.Target
if target:FindFirstChild("CanHarvest") then
if target:FindFirstChild("CanHarvest") then
if char.UpperTorso.Position.X - target.Position.X > -10 or char.UpperTorso.Position.X - target.Position.X < 10 then
if char.UpperTorso.Position.Z - target.Position.Z > -10 or char.UpperTorso.Position.Z - target.Position.Z < 10 then
print("ITS WORKING! (Maybe)")
m.overTarget = true
end
end
else
m.overTarget = false
end
else
m.overTarget = false
end
end)

2 comments
okay i did not read ur script but ill write something similar to what ur asking for
ps pls arrange it