#This checks if its your farm before placing the egg
1 messages · Page 1 of 1 (latest)
Looks good for me, whats the problem?
its printing not your farm even tho it is my farm
try debugging farm/owner and see the result
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
still not working ima send a photo
U didnt change nothing wdym
oh shit same screen
Lol
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
when i click on the farm sign a script creats a string value in the farm selected
Use FindFirstAncestor, not Class.
But u can search by the name or else it will find another model first
is it fixed?
Is it a string value or an object value ?
no
the value Owner in the script is a string value
Did you define the owner somewhere or did you do it manuel?
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
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
local ownerTag = Instance.new("StringValue")
ownerTag.Name = "Owner"
ownerTag.Value = player.Name
ownerTag.Parent = farmModel
** You are now Level 2! **
this is in the sign script
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)
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?
Fine, let me take a look
what is your user