#This checks if its your farm before placing the egg

1 messages · Page 1 of 1 (latest)

iron cypress
#

i really need help

austere cave
#

Looks good for me, whats the problem?

iron cypress
#

its printing not your farm even tho it is my farm

austere cave
#

try debugging farm/owner and see the result

silver warren
#

So maybe the target its a part

#

Of the farm

#

Try to get the firstancester

#

With teh name of the farm

#

Maybe it would work

iron cypress
#

still not working ima send a photo

silver warren
#

Mk

#

Kk

iron cypress
silver warren
#

U didnt change nothing wdym

iron cypress
#

oh shit same screen

silver warren
#

Lol

iron cypress
silver warren
#

Do all the farms have the same name

#

Or the players name?

#

Cus there can be different models inside the farm

#

U should use FindFirstAncestor

#

With the name of the farm

#

Instand of the Class thing

iron cypress
#

when i click on the farm sign a script creats a string value in the farm selected

iron cypress
#

but the farm is a model

austere cave
#

Use FindFirstAncestor, not Class.

silver warren
knotty sable
fast sleet
iron cypress
iron cypress
knotty sable
silver warren
#

r u sure the farm vairable is rllt getting the the farm

#

cus there could be other models inside the farm that could be found first

#

thats why u should find the name and not the class

iron cypress
#

local tool = script.Parent

tool.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

    local target = mouse.Target
    if not target then return end

    local farm = target:FindFirstAncestor("farm")
    if not farm then 
        print("no farm")
    return end
    

    local owner = farm:FindFirstChild("Owner")
    if not owner or owner.Value ~= player.Name then
        warn("Not your farm!")
    return end 


    local placePosition = mouse.Hit.Position
    game.ReplicatedStorage.PlaceEgg:FireServer(tool.Name, placePosition)
    tool:Destroy()
end)

end)

#

alwase not working

iron cypress
wanton mossBOT
#

studio** You are now Level 2! **studio

iron cypress
#

this is in the sign script

austere cave
#

i would suggest you do the debug as i mentinoed it first, i belive farm or owner gives nil? or so?

Test it out

print(farm)
print(owner)
print(owner.Value)
iron cypress
#

where do i put it

#

ok @austere cave can you pls go in my studio and check it out

austere cave
#
 local farm = target:FindFirstAncestor("farm")
        if not farm then 
            print("no farm")
        return end

        print(farm)

        local owner = farm:FindFirstChild("Owner")
        if not owner or owner.Value ~= player.Name then
            print(owner)
            print(owner.Value)
             warn("Not your farm!")
        return end 
#

What does it say?

iron cypress
#

farm

#

nil

#

?

austere cave
iron cypress
#

what is your user