local function Run()
if Mouse.Target then
if Mouse.Target:IsDescendantOf(workspace.Accorns) and not Interaction then
Interaction = Mouse.Target
end
end
if Interaction ~= nil then
if Interaction.Name == 'Accorn' then
Notification("Collected +1 Accorn!")
Events.Pickup:FireServer(Interaction)
print(Interaction.Name)
return
end
if Interaction.Name == 'Tree' then
if Events.HasBellotas:InvokeServer(Interaction) then
Events.Tree:FireServer(Interaction)
else
end
end
end
end
Maybe because Mouse.Target is not actually descendant of workspace.Accorns, try something like that, I guess:
local function Run()
if Mouse.Target ~= nil then
if Mouse.Target.Name and not Interaction then
Interaction = Mouse.Target
end
end
if Interaction ~= nil then
if Interaction.Name == 'Accorn' then
Notification("Collected +1 Accorn!")
Events.Pickup:FireServer(Interaction)
print(Interaction.Name)
return
end
if Interaction.Name == 'Tree' then
if Events.HasBellotas:InvokeServer(Interaction) then
Events.Tree:FireServer(Interaction)
else
print(false)
end
end
end
end
Not to be rude, you are not helping at all.
I am not printing an object, and you can print an object since it returns its name.
I am printing Name of it
local Players = game:GetService(âPlayersâ)
local player = Players.LocalPlayer
local Mouse = player:GetMouse()
local Interaction
local function Run()
if Mouse.Target ~= nil then
if Mouse.Target.Name and not Interaction then
Interaction = Mouse.Target
end
end
if Interaction ~= nil then
print(Interaction)
if Interaction.Name == 'Baseplate' then
print(Interaction.Name)
return
end
if Interaction.Name == 'Tree' then
end
end
Also, do you mean with that picture that Interaction is nil at the if check or at the print?
If "If Interaction.Name == âAcornâ then " passes you should move the print(Interaction) lower to just before it the error line.