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)
place this in StarterPack or something; unless if u have already solved it
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.Move:connect(function() local target = mouse.Target if target:FindFirstChild("CanHarvest") ~= nil and (player.Character.HumanoidRootPart.Position - target.Position).magnitude < 10 then print("yey") end end)