Im trying to create a fish proximity prompt appear if the player is near and equipping a certain tool by using instance tagging module script

Script:
local PlayerManager = require(script.Parent.Parent.PlayerManager)

local Fish = {}
Fish.__index = Fish

function Fish:OnSpawn()
local plrs = game.Players:GetPlayers()

for i,v in plrs do
    local tool = v.Backpack.Net
    if v:FindFirstChild("Character") then
        local char = v:FindFirstChild("Character")
        if char:FindFirstChild("HumanoidRootPart") then
            local magnitude = (self.Instance.Postition  - char:FindFirstChild("HumanoidRootPart").Position).Magnitude
            if magnitude <= 30 and tool.Equipped == true then
                local prox = Instance.new("ProximityPrompt")
                prox.Parent = self.Instance
                prox.ActionText = "Collect Fish"
                prox.ObjectText = "Fish"
                prox.HoldDuration = 2
            end
        end
    end
end

end

function Fish:Init()
self.Instance:OnSpawn()
end

return Fish

2 Likes

Can you specify what the issue is?
And also, you have a typo here:
local magnitude = (self.Instance.Postition - char:FindFirstChild("HumanoidRootPart").Position).Magnitude

The script doesnt work entirely

uhh ‘Character’ isn’t a child of player, it is a property of player that holds a reference to the player’s character. Therefore FindFirstChild will return nil, instead use v.Character and the if statement should run.