#module is confusing the model as the player's House

1 messages · Page 1 of 1 (latest)

pulsar shell
#

i have tried with player and character and it still confuses them with the "papu" Model

module.Bought(papu, House)
print(" Papu Bought:", papu.Name, " House:", House.Name)

local BrainRotBoughtPart = House:FindFirstChild("BrainrotBoughtPart")
if not BrainRotBoughtPart then
    warn(" BrainrotBoughtPart not found in", House.Name)
    return
end

local humanoid = papu:FindFirstChild("Humanoid")
local hrp = papu:FindFirstChild("HumanoidRootPart")

if humanoid and hrp then
    print(" Papu caminando hacia:", BrainRotBoughtPart.Position)
    humanoid:MoveTo(BrainRotBoughtPart.Position)

    humanoid.MoveToFinished:Connect(function(reached)
        if reached then
            print(" Papu arrived to House: ", House.Name)
        else
            warn(" Papu Couldnt arrive")
        end
    end)
else
    warn(" Papu does not have Humanoid or HumanoidRootPart:", papu.Name)
end

end


#

second script:
local Module = require(script.Parent.Main.Module)

game.DescendantAdded:Connect(function(desc)
if desc:IsA("ProximityPrompt") and desc.Name == "Comprar" then
desc.Triggered:Connect(function(Buyer)
local Character = Buyer.Character or Buyer.CharacterAdded:Wait()

        local papu = desc:FindFirstAncestorWhichIsA("Model")
        if not papu or not papu:FindFirstChild("Humanoid") then
            warn("No valid papu model found for ProximityPrompt")
            return
        end

        local House = nil
        local current = Character.Parent
        while current and current ~= workspace do
            if current:FindFirstChild("BrainrotBoughtPart") then
                House = current
                break
            end
            current = current.Parent
        end

        if not House then
            warn("No house found for", Buyer.Name)
            return
        end

        print("Buyer:", Buyer.Name, "| House:", House.Name, "| Papu:", papu.Name)
        Module:Bought(papu, House)
    end)
end

end)

vital pasture
#

game.DescendantAdded:Connect(function(desc)
    if desc:IsA("ProximityPrompt") and desc.Name == "Comprar" then
        desc.Triggered:Connect(function(Buyer)
            local Character = Buyer.Character or Buyer.CharacterAdded:Wait()

            local papu = desc:FindFirstAncestorWhichIsA("Model")
            if not papu or not papu:FindFirstChild("Humanoid") then
                warn("No valid papu model found for ProximityPrompt")
                return
            end

            local House = nil
            local current = Character.Parent
            while current and current ~= workspace do
                if current:FindFirstChild("BrainrotBoughtPart") then
                    House = current
                    break
                end
                current = current.Parent
            end

            if not House then
                warn("No house found for", Buyer.Name)
                return
            end

            print("Buyer:", Buyer.Name, "| House:", House.Name, "| Papu:", papu.Name)
            Module:Bought(papu, House)
        end)
    end
end)```
#

It might be cuz the buyer is the first parameter

#

Whats papu supposed to be?

#

if papu is a model then

#

would it be better to do

#

module.Bought(player: Player, papu: Model, House: Model)

#

since you define what exactly they are supposed to be

#

you can still get the player who bought it as

#

module.Bought(buyer: Player, papu: Model, House: Model)

pulsar shell
#

oh my god, bro is big brain