RayCastParams Always Attempting To Call A Table Value

	
	plr.CharacterAdded:Connect(function(char)
		
		local RemoteEvent = game.ReplicatedStorage:FindFirstChild(plr.Name .. ("RemoteEvents"))

		while not RemoteEvent do wait(1)  RemoteEvent = game.ReplicatedStorage:FindFirstChild(plr.Name .. ("RemoteEvents")) end

		
		RemoteEvent = RemoteEvent:FindFirstChild("MirrorSend")
		
		RemoteEvent.OnServerEvent:Connect(function(plr,StartRay,EndRay,MirrorSend)
			local char = plr.Character
			print(plr,StartRay,EndRay,MirrorSend)

			local StartRay = game.ReplicatedStorage:FindFirstChild(plr.Name .. ("StandAssets"))
			print(StartRay)
			local EndRay = StartRay:FindFirstChild("EndRay")
			local MirrorSend = StartRay:FindFirstChild("MirrorSend")
			StartRay = StartRay:FindFirstChild("StartRay")
			
			StartRay.CFrame = char.HumanoidRootPart.CFrame
			EndRay.CFrame = char.HumanoidRootPart.CFrame * CFrame.new (0,0,-20)
			MirrorSend:SetPrimaryPartCFrame(char.HumanoidRootPart.CFrame * CFrame.new(0,0,-10))
			
			StartRay.Parent = game.Workspace.TempEffects
			EndRay.Parent = game.Workspace.TempEffects
			MirrorSend.Parent = game.Workspace.TempEffects
			
			local Filter = game.Players:GetChildren()
			local RayCastWhiteList = RaycastParams.new
			
			RayCastWhiteList.FilterDescendantsInstances{StartRay{}
			RayCastWhiteList.FilterType = Enum.RaycastFilterType.Whitelist
			
			
			while wait() do
				local result = workspace:Raycast(StartRay.Position, EndRay.Position -StartRay.Position, RayCastWhiteList)
				print(result)
			end
			
		end)
			
		end)
		
	end)

No matter what I try to whitelist or blacklist, even if a single part, I get the same error.

ServerScriptService.MirrorManSend:33: attempt to call a table value - Server - MirrorManSend:33
I really have no idea why, please help.

Could you please use the lua format, or at least show us what is on line 33 in the image?

The error is happening because you’re using {} brackets rather than (). The line should look like such:

RayCastWhiteList.FilterDescendantsInstances = {StartRay} 

Edit: yeah connect pointed out the mistake lmfao mb, fixed it

RayCastWhiteList.FilterDescendantsInstances = {StartRay}
it should be

also use task.wait(), would be more consistent for your user case

1 Like

ServerScriptService.MirrorManSend:33: attempt to index function with 'FilterDescendantsInstances' - Server -

The error I get upon changing as such.

My apologies. The post has since been fixed.