Hi!
Simple issue, when trying to get IsDecendantOf(), I get the error in the title.
Code:
--function:
local function StartDel(v)
if not v.Name == "Grid" and v:IsDecendantOf(BuildPlate) then
v:Destroy()
end
end
--later in the code, probably like 200 lines down
script.Parent.Parent.Parent.ControlBar.Delete.MouseButton1Click:Connect(function()
Mouse.Move:Connect(function()
if not Player.PlayerGui:FindFirstChild("BuildSelection") then
local BuildSelection = Instance.new("SelectionBox")
BuildSelection.Parent = Player.PlayerGui
BuildSelection.Color3 = Color3.fromRGB(255, 69, 72)
end
local Box = Player.PlayerGui:FindFirstChild("BuildSelection")
if Mouse.Target:IsDescendantOf("BuildPlot") then
Box.Adornee = Mouse.Target
Mouse.Button1Up:Connect(function()
StartDel(Mouse.Target)
end)
else
Box.Adornee = nil
end
end)
end)
script.Parent.Parent.Parent.ControlBar.Delete.MouseButton1Click:Connect(function()
Mouse.Move:Connect(function()
if not Player.PlayerGui:FindFirstChild("BuildSelection") then
local BuildSelection = Instance.new("SelectionBox")
BuildSelection.Parent = Player.PlayerGui
BuildSelection.Color3 = Color3.fromRGB(255, 69, 72)
BuildSelection.Name = "BuildSelection"
end
local Box = Player.PlayerGui:FindFirstChild("BuildSelection")
if Mouse.Target:IsDescendantOf(BuildPlate) then
Box.Adornee = Mouse.Target
Mouse.Button1Up:Connect(function()
StartDel(Mouse.Target)
end)
else
Box.Adornee = nil
end
end)
end)
script.Parent.Parent.Parent.ControlBar.Delete.MouseButton1Click:Connect(function()
Mouse.Move:Connect(function()
if not Player.PlayerGui:FindFirstChild("BuildSelection") then
local BuildSelection = Instance.new("SelectionBox")
BuildSelection.Parent = Player.PlayerGui
BuildSelection.Color3 = Color3.fromRGB(255, 69, 72)
BuildSelection.Name = "BuildSelection"
end
local Box = Player.PlayerGui:FindFirstChild("BuildSelection")
if Mouse.Target and Mouse.Target:IsDescendantOf(BuildPlate) then
Box.Adornee = Mouse.Target
Mouse.Button1Up:Connect(function()
StartDel(Mouse.Target)
end)
else
Box.Adornee = nil
end
end)
end)