hello, im creating a system for drops and when i try to pick it up
it gives this message
i found the issue but i can’t fix it!
here the code for reference
RunService.Stepped:Connect(function()
for _, Drop in WorkspaceDrops:GetChildren() do
for i, Player in Players:GetChildren() do
local Character = Player.Character or Player.CharacterAdded:Wait()
if Character and Drop and Drop.Parent ~= nil then
if (Character.PrimaryPart.Position - Drop.PrimaryPart.Position).Magnitude < 10 and Drop.CanCollect.Value == true then
if Character:WaitForChild("Humanoid").Health ~= 0 then
Drop.PrimaryPart.CFrame = Drop.PrimaryPart.CFrame:Lerp(Character.PrimaryPart.CFrame, 0.1)
if (Character.PrimaryPart.Position - Drop.PrimaryPart.Position).Magnitude < 2 then
if not Debounces[Drop] then
Debounces[Drop] = true
local d = ReplicatedStorage.Remotes.CollectDrop:FireServer(Player,Drop.Name) or ReplicatedStorage.Remotes.CollectDrop:FireClient(Player,Drop.Name) -- the issue is here
task.wait(3)
Debounces[Drop] = nil
end
Drop:Destroy()
end
end
end
end
end
end
end)
return module
if you can find something im here to see
ot before closing i wanted to say: all the code works but it gives error