Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do i fix arguement Missing or nil error?

local rp = game:GetService("ReplicatedStorage")
	local summon = rp:WaitForChild("Summon")

local Debris = game:GetService("Debris")
	local tweenservice = game:service("TweenService")
	 
	summon.OnServerEvent:connect(function(player,isactive)
		    local character = player.character
		    local humanoid = character.Humanoid
		    local Humrp = character.HumanoidRootPart
		 
		    if isactive then
			        local Humrp = character.HumanoidRootPart
			        local stand = script:WaitForChild("Stand"):Clone()
			 
			        for _, part in pairs(stand:GetChildren()) do
				            if part:IsA ("BasePart") then
					                part.Transparency = 1
			            end
			        end
		 
	        stand.Parent = character
			 
		local weld = Instance.new("ManualWeld")
		weld.Name = "Controller"
			        weld.Part0 = stand.PrimaryPart
			        weld.Part1 = Humrp
			        weld.C0 = weld.Part0.CFrame.ToObjectSpace(weld.Part1.CFrame)
		        weld.Parent = weld.Part0
			 
			        local AnimControl = stand:FindFirstChild("AnimControl")
			        local standhumrp = stand:FindFirstChild("HumanoidRootPart")
			 
			        local Idle = AnimControl:LoadAnimation(script.Idle)
			        Idle:play()
			 
			        for _, part in pairs(stand:GetChildren()) do
				            if part:IsA ("BasePart") and part ~= standhumrp then
					                local goal = {}
					                goal.Transparency = 0
					                local info = TweenInfo.new(.5)
					                local tween = tweenservice:create(part,info,goal)
					                tween:play()
					 
					            end
				        end
		 
		        local goal = {}
	        goal.C0=weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
			        goal.C1 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame * CFrame.new(-3,1,2))
			        local info = TweenInfo.new(.5)
		        local tween = tweenservice:create(weld,info,goal)
			        tween:play()
			 
			    else
		local stand = character:FindFirstChild("Stand")
		if stand then
			local standhumrp = stand:FindFirstChild("HumanoidRootPart")
			local Controller = stand.PrimaryPart:FindFirstChild("Controller")
			if Controller then
				local standHumrp = stand:FindFirstChild("HumanoidRootPart")
				for _, part in pairs(stand:GetChildren()) do
					if part:IsA ("BasePart") and part ~= standHumrp then
						local goal = {}
						goal.Transparency = 1
						local info = TweenInfo.new(.5)
						local tween = tweenservice:create(part,info,goal)
						tween:play()

					end
				end
				
				local goal = {}
				goal.C0=Controller.Part0.CFrame:ToObjectSpace(Controller.Part1.CFrame)
				goal.C1 = Controller.Part0.CFrame:ToObjectSpace(Controller.Part1.CFrame * CFrame.new(-0,0,0))
				local info = TweenInfo.new(.5)
				local tween = tweenservice:create(Controller,info,goal)
				tween:play()
				tween.completed:connect(function()
					Debris:AddItem()(stand,.05)
                    end)
				end
			 end
	   	 end
	end)

Line: 80

Error:Argument 1 missing or nil  

2 answers

Change

Debris:AddItem()(stand,.05)

To

Debris:AddItem(stand,.05)

The reason for this error is that you are calling what Debris:AddItem returns, which it returns nil, in your case you want to call the function so put all the arguments into the bracket.

Put the code inside the parenthesis so it sees the value you placed in the function.

local rp = game:GetService("ReplicatedStorage")
    local summon = rp:WaitForChild("Summon")

local Debris = game:GetService("Debris")
    local tweenservice = game:service("TweenService")

    summon.OnServerEvent:connect(function(player,isactive)
            local character = player.character
            local humanoid = character.Humanoid
            local Humrp = character.HumanoidRootPart

            if isactive then
                    local Humrp = character.HumanoidRootPart
                    local stand = script:WaitForChild("Stand"):Clone()

                    for _, part in pairs(stand:GetChildren()) do
                            if part:IsA ("BasePart") then
                                    part.Transparency = 1
                        end
                    end

            stand.Parent = character

        local weld = Instance.new("ManualWeld")
        weld.Name = "Controller"
                    weld.Part0 = stand.PrimaryPart
                    weld.Part1 = Humrp
                    weld.C0 = weld.Part0.CFrame.ToObjectSpace(weld.Part1.CFrame)
                weld.Parent = weld.Part0

                    local AnimControl = stand:FindFirstChild("AnimControl")
                    local standhumrp = stand:FindFirstChild("HumanoidRootPart")

                    local Idle = AnimControl:LoadAnimation(script.Idle)
                    Idle:play()

                    for _, part in pairs(stand:GetChildren()) do
                            if part:IsA ("BasePart") and part ~= standhumrp then
                                    local goal = {}
                                    goal.Transparency = 0
                                    local info = TweenInfo.new(.5)
                                    local tween = tweenservice:create(part,info,goal)
                                    tween:play()

                                end
                        end

                local goal = {}
            goal.C0=weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
                    goal.C1 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame * CFrame.new(-3,1,2))
                    local info = TweenInfo.new(.5)
                local tween = tweenservice:create(weld,info,goal)
                    tween:play()

                else
        local stand = character:FindFirstChild("Stand")
        if stand then
            local standhumrp = stand:FindFirstChild("HumanoidRootPart")
            local Controller = stand.PrimaryPart:FindFirstChild("Controller")
            if Controller then
                local standHumrp = stand:FindFirstChild("HumanoidRootPart")
                for _, part in pairs(stand:GetChildren()) do
                    if part:IsA ("BasePart") and part ~= standHumrp then
                        local goal = {}
                        goal.Transparency = 1
                        local info = TweenInfo.new(.5)
                        local tween = tweenservice:create(part,info,goal)
                        tween:play()

                    end
                end

                local goal = {}
                goal.C0=Controller.Part0.CFrame:ToObjectSpace(Controller.Part1.CFrame)
                goal.C1 = Controller.Part0.CFrame:ToObjectSpace(Controller.Part1.CFrame * CFrame.new(-0,0,0))
                local info = TweenInfo.new(.5)
                local tween = tweenservice:create(Controller,info,goal)
                tween:play()
                tween.completed:connect(function()
                    Debris:AddItem(stand,.05)
                    end)
                end
             end
         end
    end)


This discussion is preserved as it was. New answers, comments, and votes are closed.