I have a function where you click a sight attachment, and it attaches to your gun. However, the statements at lines 18 and 28 do not work, but do not create any errors. It seems like they are completely ignored. Is there a way to fix this or is there some sort of limit to how many conditions can be used in a function?
attachments.Mini.Click:FindFirstChild("ClickDetector").MouseClick:connect(function()
local attpoint = self.current:FindFirstChild("optic")
local handle = self.current:FindFirstChild("Handle")
local origin = self.current:FindFirstChild("HandleOrigin")
if interaction == true and attpoint.Mini.Value == true then
deleteFrame()
if currentoptic == nil then
Mini()
elseif currentoptic ~= nil and currentoptic ~= Mini then
currentoptic:Destroy()
RISoff()
handle.Position = origin.Position
currentoptic = nil
attpoint:FindFirstChild("Motor6D"):Destroy()
self.config.aimFOV = 70
self.config.zoomScale = 1
Mini()
elseif currentoptic == Mini then
currentoptic:Destroy()
RISoff()
handle.Position = origin.Position
currentoptic = nil
attpoint:FindFirstChild("Motor6D"):Destroy()
self.config.aimFOV = 70
self.config.zoomScale = 1
end
if self.current:FindFirstChild("Iron Sights") then
local children = self.current:FindFirstChild("Iron Sights"):GetChildren()
for i = 1,#children do
children[i].Transparency = 0
end
end
end
end)

1 comment
anytime your if statements do not work, make sure your ends are correct and the variables you are comparing mean what you think they mean.