I am trying to create a tool that will write inventions into a crafting tool for my game. It gives me this error: "10:57:20.902 - Players.Player.Backpack.Inventor.LocalScript:16: attempt to index field 'Target' (a nil value)" It is in a local script that is in a hopperbin.
local T = script.Parent
local P = game.Players.LocalPlayer
local M = P:GetMouse()
local I = {}
local i = {"hi", "hi", "hi"}
function CreateGui()
T.ScreenGui.Parent = P.PlayerGui
end
function RemoveGui()
P.PlayerGui.ScreenGui.Parent = T
end
function Target()
if M.Target ~= nil then
P.ScreenGui.Target.Text = "Target: " .. M.Target
end
end
T.Selected:connect(CreateGui)
T.Deselected:connect(RemoveGui)
M.Target.Changed:connect(Target)
